summaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* os-util: allow matching versioned image with extension-release fileLuca Boccassi2024-03-283-55/+62
| | | | | | | Currently app_1.0.raw is refused if it contains extension-release.d/extension-release.app, which stops one from using versioned images without using the force flag to disable the check. Relax it so that only the actual name, and not the version, is compared, like it already happens in other places.
* Merge pull request #31994 from yuwata/network-dhcp-server-follow-upsLuca Boccassi2024-03-282-1/+2
|\ | | | | network: several fixlets for PersistLeases=
| * network: make [DHCPServer] in networkd.conf workYu Watanabe2024-03-281-0/+1
| | | | | | | | | | | | Follow-up for a3ed665a29ea9355c78a2a6b3a032b9504499dd6. Fixes https://github.com/systemd/systemd/pull/31977#discussion_r1542196572.
| * network: fix typoYu Watanabe2024-03-281-1/+1
| | | | | | | | Follow-up for a3ed665a29ea9355c78a2a6b3a032b9504499dd6.
* | ndisc-option: allow to set valid time of optionsYu Watanabe2024-03-284-81/+380
| | | | | | | | | | | | | | | | | | | | When an option is delegated from an upstream server, its lifetime may be limited by a time. Such functionality will be used later by sd-radv. This also remove 'offset' argument from the option setter ndisc_option_set_xyz(), and make it update existing option. See comments in ndisc_option_add_link_layer_address() for more details.
* | journalctl-filter: use add_match_boot_id() instead of add_match_this_boot()Yu Watanabe2024-03-281-5/+1
| | | | | | | | | | | | The function add_match_this_boot() calls sd_journal_add_conjunction(), hence, we cannot specify multiple devices in the extra match arguments, e.g., "journalctl /dev/sda /dev/sdb" shows no entry.
* | homed: Release(): fix assertion failureAdrian Vovk2024-03-283-27/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a race condition crash in homed that would happen in the following sequence of events: 1. Client 1 takes a ref on the home area 2. Client 1 calls some method via dbus 3. Client 2 calls Release() In homed, the Release() would check if a ref is still held (in this case: yes it is) and returns an error. Except that is done through a code-path that asserts that no operations are ongoing. In this case, it's valid to have an ongoing operation, and so the assertion fails causing homed to crash.
* | run: fix generated unit name clash after soft-rebootLuca Boccassi2024-03-281-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When sd-run connects to D-Bus rather than the private socket, it will generate the transient unit name using the bus ID assigned by the D-Bus broker/daemon. The issue is that this ID is only unique per D-Bus run, if the broker/daemon restarts it starts again from 1, and it's a simple incremental counter for each client. So if a transient unit run-u6.service starts and fails, and it is not collected (default on failure), and the system soft-reboots, any new transient unit might conflict as the counter will restart: Failed to start transient service unit: Unit run-u6.service was already loaded or has a fragment file. Get the soft-reboot counter, and if it's greater than zero, append it to the autogenerated unit name to avoid clashes.
* | Merge pull request #31963 from yuwata/journalctl-authenticate-cleanupsYu Watanabe2024-03-281-88/+74
|\ \ | |/ |/| journalctl-authenticate: several cleanups
| * journalctl-authenticate: return earlier if we are not on a TTYYu Watanabe2024-03-281-56/+49
| | | | | | | | No functional change, just refactoring.
| * journalctl-authenticate: use open_tmpfile_linkable() and link_tmpfile()Yu Watanabe2024-03-281-21/+16
| | | | | | | | | | | | This also - use path_join(), - rename variables to more descriptive names.
| * journalctl-authenticate: drop unnecessary safe_close()Yu Watanabe2024-03-281-1/+0
| | | | | | | | | | | | Follow-up for 7560fffcd2531786b9c1ca657667a43e90331326. Addresses https://github.com/systemd/systemd/pull/31879#discussion_r1539063239.
| * journalctl-authenticate: use is_dir() and refuse symlink for /var/log/journalYu Watanabe2024-03-281-10/+9
| | | | | | | | | | | | | | I am not sure it is explicitly documented that /var/log/journal should be a directory, rather than a symlink to a directory, but the current code of journald seems not to support symlinked directory well. Let's refuse that at least here and now.
* | timedate: fix typoYu Watanabe2024-03-281-1/+1
|/ | | | Follow-up for 3a51e31be9f626cf772733cb289ed64739fab0e4.
* analyze: fix plot with soft-rebootLuca Boccassi2024-03-272-7/+51
| | | | | | Clamp times and start counting from when soft-reboot is started to avoid creating a huge graph, like it's done for the user instance.
* timedated: Respond on org.freedesktop.timedate1.SetNTP only when really finishedMichal Koutný2024-03-271-3/+18
| | | | | | | | | | | | | The method returns prematurely (before jobs it triggers terminate). This is externally visible because other methods may fail if jobs did not finish. Postpone the DBus method response until we collect all signals for finished jobs. systemd-timedated keeps track of in-flight DBus requests and answers them all in unspecified order when jobs finish. The capacity of requests in systemd-timedated is limited. Fixes: #17739
* network/dhcp-server: introduce PersistLeases= settingYu Watanabe2024-03-278-2/+28
| | | | Requested at https://github.com/systemd/systemd/pull/31772#issuecomment-2000053357.
* journalctl-show/util: add missing headerAntonio Alvarez Feijoo2024-03-272-0/+4
| | | | | | | | | | | | | | | | | | | | | | | ``` [1237/2836] Compiling C object journalctl.p/src_journal_journalctl-show.c.o FAILED: journalctl.p/src_journal_journalctl-show.c.o cc -Ijournalctl.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fvisibility=hidden -fno-omit-frame-pointer -include config.h -pthread -MD -MQ journalctl.p/src_journal_journalctl-show.c.o -MF journalctl.p/src_journal_journalctl-show.c.o.d -o journalctl.p/src_journal_journalctl-show.c.o -c ../src/journal/journalctl-show.c ../src/journal/journalctl-show.c: In function ‘setup_event’: ../src/journal/journalctl-show.c:330:38: error: ‘STDOUT_FILENO’ undeclared (first use in this function) 330 | r = sd_event_add_io(e, NULL, STDOUT_FILENO, EPOLLHUP|EPOLLERR, NULL, INT_TO_PTR(-ECANCELED)); | ^~~~~~~~~~~~~ ../src/journal/journalctl-show.c:330:38: note: each undeclared identifier is reported only once for each function it appears in [1238/2836] Compiling C object journalctl.p/src_journal_journalctl-util.c.o FAILED: journalctl.p/src_journal_journalctl-util.c.o cc -Ijournalctl.p -I. -I.. -Isrc/basic -I../src/basic -Isrc/fundamental -I../src/fundamental -Isrc/systemd -I../src/systemd -I../src/libsystemd/sd-bus -I../src/libsystemd/sd-device -I../src/libsystemd/sd-event -I../src/libsystemd/sd-hwdb -I../src/libsystemd/sd-id128 -I../src/libsystemd/sd-journal -I../src/libsystemd/sd-netlink -I../src/libsystemd/sd-network -I../src/libsystemd/sd-resolve -Isrc/shared -I../src/shared -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O0 -g -Wno-missing-field-initializers -Wno-unused-parameter -Wno-nonnull-compare -Warray-bounds -Warray-bounds=2 -Wdate-time -Wendif-labels -Werror=format=2 -Werror=format-signedness -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Werror=missing-declarations -Werror=missing-prototypes -Werror=overflow -Werror=override-init -Werror=return-type -Werror=shift-count-overflow -Werror=shift-overflow=2 -Werror=undef -Wfloat-equal -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-aliasing=2 -Wstrict-prototypes -Wsuggest-attribute=noreturn -Wunused-function -Wwrite-strings -Wzero-length-bounds -fdiagnostics-show-option -fno-common -fstack-protector -fstack-protector-strong --param=ssp-buffer-size=4 -Wno-unused-result -Werror=shadow -fno-strict-aliasing -fvisibility=hidden -fno-omit-frame-pointer -include config.h -pthread -MD -MQ journalctl.p/src_journal_journalctl-util.c.o -MF journalctl.p/src_journal_journalctl-util.c.o.d -o journalctl.p/src_journal_journalctl-util.c.o -c ../src/journal/journalctl-util.c ../src/journal/journalctl-util.c: In function ‘acquire_journal’: ../src/journal/journalctl-util.c:36:60: error: ‘STDIN_FILENO’ undeclared (first use in this function) 36 | r = sd_journal_open_files_fd(&j, (int[]) { STDIN_FILENO }, 1, arg_journal_additional_open_flags); | ^~~~~~~~~~~~ ../src/journal/journalctl-util.c:36:60: note: each undeclared identifier is reported only once for each function it appears in ``` Fixes ade2db83fe7fa5011490f94fbeb5cf9263f26514
* sd-ndisc-router: introduce sd_ndisc_router_set_sender_address()Yu Watanabe2024-03-274-0/+19
| | | | | Currently this is not used, but will be used later to modify the sender address.
* ndisc-option: add HomeAgent option supportYu Watanabe2024-03-272-11/+88
| | | | Currently, these are not used, but will be used later in sd-radv.
* Merge pull request #31965 from yuwata/logs-show-cleanupsLuca Boccassi2024-03-275-88/+92
|\ | | | | logs-show: several cleanups
| * logs-show: read the current boot ID if nothing specified for add_match_boot_id()Yu Watanabe2024-03-262-12/+15
| | | | | | | | No functional change, just refactoring.
| * sd-id128: move get_boot_id_for_machine() to id128-util.cYu Watanabe2024-03-264-82/+83
| | | | | | | | | | | | | | And rename it to id128_get_boot_for_machine(). This also splits out id128_get_boot() from sd_id128_get_boot(), and make id128_get_boot_for_machine() use it.
* | Merge pull request #31964 from yuwata/journalctl-filter-cleanupsLuca Boccassi2024-03-272-175/+141
|\ \ | | | | | | journalctl-filter: several cleanups
| * | journalctl-filter: several cleanups for add_matches()Yu Watanabe2024-03-261-92/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - split it into small pieces to reduce indentation, - return earlier if no filter specified, - use journal_add_matchf() and journal_add_match_pair(), chase_and_stat(), is_symlink(), and sd_device_new_from_devname(), - replace sd_device_get_devname() + stat() with sd_device_get_devnum(), - refuse to install filter by path with --root, --image, or --machine at least now, as previously it has not worked anyway.
| * | journalctl-filter: add missing sd_journal_add_conjunction()Yu Watanabe2024-03-261-1/+1
| | | | | | | | | | | | | | | Otherwise, if --facility= is specified with extra matches with '+', the facility filter will not be applied to the specified filter after '+'.
| * | journalctl-filter: several trivial cleanupsYu Watanabe2024-03-262-42/+25
| | | | | | | | | | | | | | | | | | - declare iterator in loop, - use journal_add_match_pair() and journal_add_matchf(), - log failures in the caller.
| * | journalctl-filter: modernize add_units()Yu Watanabe2024-03-261-43/+36
| |/ | | | | | | | | | | | | | | | | - add missing assertions, - use set_ensure_consume() and strv_consume(), - use string_hash_ops_free and _cleanup_set_free_, - use strv_fnmatch_full(), - replace unused counter with a boolean flag, - return earlier if no unit filtering is requested.
* | core: add counter for soft-reboot iterationsLuca Boccassi2024-03-274-1/+18
| | | | | | | | | | Allow to query via D-Bus how many times the current booted system has been soft rebooted
* | analyze: show only current times after soft-rebootLuca Boccassi2024-03-272-1/+8
| | | | | | | | | | The firmware/loader/kernel times are no longer relevant for the startup sequence on soft-reboot, so use only the userspace timestamps
* | core: add SoftRebootStartTimestampLuca Boccassi2024-03-274-1/+18
| | | | | | | | | | Will be useful to calculate how long it took to shut down the system before starting in the new root
* | core: do not serialize timestamps that are re-measured on soft-rebootLuca Boccassi2024-03-271-4/+5
| | | | | | | | | | | | Otherwise the de-serialization overwrites the timestamps taken after soft-reboot (e.g.: userspace start/finish) and sd-analyze shows bogus data
* | Merge pull request #31789 from jsitnicki/socket-pass-fds-to-execYu Watanabe2024-03-275-0/+29
|\ \ | | | | | | Pass socket FDs to all ExecXYZ= commands in socket unit but ExecStartPre=
| * | socket: pass socket FDs to all ExecXYZ= commands but ExecStartPre=Jakub Sitnicki2024-03-265-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Today listen file descriptors created by socket unit don't get passed to commands in Exec{Start,Stop}{Pre,Post}= socket options. This prevents ExecXYZ= commands from accessing the created socket FDs to do any kind of system setup which involves the socket but is not covered by existing socket unit options. One concrete example is to insert a socket FD into a BPF map capable of holding socket references, such as BPF sockmap/sockhash [1] or reuseport_sockarray [2]. Or, similarly, send the file descriptor with SCM_RIGHTS to another process, which has access to a BPF map for storing sockets. To unblock this use case, pass ListenXYZ= file descriptors to ExecXYZ= commands as listen FDs [4]. As an exception, ExecStartPre= command does not inherit any file descriptors because it gets invoked before the listen FDs are created. This new behavior can potentially break existing configurations. Commands invoked from ExecXYZ= might not expect to inherit file descriptors through sd_listen_fds protocol. To prevent breakage, add a new socket unit parameter, PassFileDescriptorsToExec=, to control whether ExecXYZ= programs inherit listen FDs. [1] https://docs.kernel.org/bpf/map_sockmap.html [2] https://lore.kernel.org/r/20180808075917.3009181-1-kafai@fb.com [3] https://man.archlinux.org/man/socket.7#SO_INCOMING_CPU [4] https://www.freedesktop.org/software/systemd/man/latest/sd_listen_fds.html
* | | resolved: always return the validated answers when validatingRonan Pigott2024-03-271-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We normally expect sd-resolved only to return the validated subset of a validated response. In some cases we give up on validating, because we have enough information already to conclude the answer is bogus. Let's be sure to always reply with only the validated subset in these cases too, so that we don't return bogus answers and confuse primitive clients that won't see the SERVFAIL rcode.
* | | resolved: minor dnssec fixupsRonan Pigott2024-03-271-2/+9
| | | | | | | | | | | | Fixes: ce5b9d5b3c24 ("resolved: request DS with DNSKEY")
* | | shared/logs-show: restore infinite loop avoidance for corrupted journalsZbigniew Jędrzejewski-Szmek2024-03-271-1/+2
| | | | | | | | | | | | | | | | | | | | | Fixes a bug introduced in e44f06065bf20e8d0e4adacff61350ebd36f299e: it was supposed to be a refactoring, but unfortunately FOREACH_ARRAY is implemented using a for loop, so when the 'goto finish' was replaced by 'break', it only broke the inner loop, leading to a infinite loop.
* | | home: fix typoYu Watanabe2024-03-261-1/+1
|/ / | | | | | | Follow-up for 5ec87d577f92effe27a62e965e02a6f9a40f81cc.
* | Merge pull request #31951 from bluca/resolve_reloadYu Watanabe2024-03-2610-12/+120
|\ \ | | | | | | resolved: support reloading configuration at runtime
| * | resolved: support reloading configuration at runtimeLuca Boccassi2024-03-2610-12/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drop connections and caches and reload config from files, to allow for low-interruptions updates, and hook up to the usual SIGHUP and ExecReload=. Mark servers and services configured directly via D-Bus so that they can be kept around, and only the configuration file settings are dropped and reloaded. Fixes https://github.com/systemd/systemd/issues/17503 Fixes https://github.com/systemd/systemd/issues/20604
* | | Merge pull request #31959 from YHNdnzj/execute-pass-fdsYu Watanabe2024-03-262-4/+6
|\ \ \ | | | | | | | | core/execute: check if EXEC_PASS_FDS is set if got exec_params.fds
| * | | core/execute: check if EXEC_PASS_FDS is set if got exec_params.fdsMike Yuan2024-03-262-1/+4
| | | | | | | | | | | | | | | | | | | | Prompted by #31789 (specifically https://github.com/systemd/systemd/pull/31789#discussion_r1525267612)
| * | | core/service: remove redundant Unit.type checkMike Yuan2024-03-261-3/+2
| | | | | | | | | | | | | | | | SOCKET(u) returns NULL if the type doesn't match.
* | | | Merge pull request #31960 from YHNdnzj/capsule-followupYu Watanabe2024-03-263-37/+28
|\ \ \ \ | | | | | | | | | | Some follow-ups for capsule
| * | | | bus-util: dedup bus_set_address_capsuleMike Yuan2024-03-261-35/+26
| | | | | | | | | | | | | | | | | | | | Follow-up for ad963c3f5680796ccd094b81f35ff7aa20b57247
| * | | | systemctl,busctl: sort includesMike Yuan2024-03-262-2/+2
| | |/ / | |/| | | | | | | | | | | | | | Follow-up for 56cb74c3cd1358d7d0b3f613feaf2eeab601a6bd and 00431b2b66cb59540deda4ea018170a289673585
* | | | dissect: fix memory leakAntonio Alvarez Feijoo2024-03-261-1/+2
| |_|/ |/| |
* | | Merge pull request #31879 from yuwata/journalctl-splitYu Watanabe2024-03-2617-1759/+2038
|\ \ \ | | | | | | | | journalctl: split journalctl.c into small pieces
| * | | journalctl-show: split out seek_journal()Yu Watanabe2024-03-261-113/+122
| | | | | | | | | | | | | | | | No functional change, just refactoring.
| * | | journalctl: split journalctl.c into small piecesYu Watanabe2024-03-2617-1750/+2029
| | | | | | | | | | | | | | | | | | | | And introduces per-action functions. No functional change, just refactoring.