summaryrefslogtreecommitdiffstats
path: root/src/debug-generator (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-06-06basic/in-addr-util: add IN_ADDR_PREFIX_TO_STRINGZbigniew Jędrzejewski-Szmek18-223/+155
2022-06-06basic/in-addr-util: drop check for prefix length in formatting functionZbigniew Jędrzejewski-Szmek3-6/+26
The general rule should be to be strict when parsing data, but lenient when printing it. Or in other words, we should verify data in verification functions, but not when printing things. It doesn't make sense to refuse to print a value that we are using internally. We were tripping ourselves in some of the print functions: we want to report than an address was configured with too-long prefix, but the log line would use "n/a" if the prefix was too long. This is not useful. Most of the time, the removal of the check doesn't make any difference, because we verified the prefix length on input.
2022-06-06libsystemd-network: minor simplificationZbigniew Jędrzejewski-Szmek1-4/+2
2022-06-06resolved: use TAKE_PTR() in one more placeZbigniew Jędrzejewski-Szmek1-3/+2
2022-06-06networkctl: assume that we can always print local networking addressesZbigniew Jędrzejewski-Szmek1-41/+18
IN6_ADDR_TO_STRING(…) always returns something, so we can simplify the code a lot. Also, let's not do step-wise concatenation, but instead handle everything with one str_extendf() call.
2022-06-06basic/in-addr-util: add IN_ADDR_TO_STRINGZbigniew Jędrzejewski-Szmek23-134/+98
Since we don't need the error value, and the buffer is allocated with a fixed size, the whole logic provided by in_addr_to_string() becomes unnecessary, so it's enough to wrap inet_ntop() directly. inet_ntop() can only fail with ENOSPC. But we specify a buffer that is supposed to be large enough, so this should never fail. A bunch of tests of this are added. This allows all the wrappers like strna(), strnull(), strempty() to be dropped. The guard of 'if (DEBUG_LOGGING)' can be dropped from around log_debug(), because log_debug() implements the check outside of the function call. But log_link_debug() does not, so it we need it to avoid unnecessary evaluation of the formatting.
2022-06-05shared/microhttp-util: silence gcc warningZbigniew Jędrzejewski-Szmek1-1/+1
../src/journal-remote/microhttpd-util.c: In function ‘check_permissions’: ../src/journal-remote/microhttpd-util.c:301:5: error: function might be candidate for attribute ‘noreturn’ [-Werror=suggest-attribute=noreturn] 301 | int check_permissions(struct MHD_Connection *connection, int *code, char **hostname) { | ^~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Fixes #23630.
2022-06-03meson: Switch default-locale default to C.UTF-8Daan De Meyer3-22/+1
We're already using C.UTF-8 as the default locale for nspawn. Let's make the same change for the default-locale option instead of deciding what to use based on the locale used by the host system. Users can still override the locale using the default-locale option if needed.
2022-06-03core: suppress message about missing libbpf if in initrd()Zbigniew Jędrzejewski-Szmek1-1/+2
It is quite likely that libbpf is not present in the initrd, and there isn't much reason to use the bpf filters there. https://bugzilla.redhat.com/show_bug.cgi?id=2084955#c25
2022-06-03cryptenroll: fix typoAntonio Alvarez Feijoo1-1/+1
2022-06-03test: add dlopen test for pam_systemd_homeYu Watanabe1-1/+9
2022-06-03sha256: fix compilation on efi-ia32Zbigniew Jędrzejewski-Szmek1-1/+1
/usr/bin/gcc -c ../src/fundamental/sha256.c -o src/boot/efi/sha256.c.o -Wno-format-signedness -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wendif-labels -Werror=format=2 -Werror=implicit-function-declaration -Werror=incompatible-pointer-types -Werror=int-conversion -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 -Wno-unused-result -fno-stack-protector -fno-strict-aliasing -fpic -fwide-exec-charset=UCS2 -Wall -Wextra -Wsign-compare -nostdlib -std=gnu99 -ffreestanding -fshort-wchar -fvisibility=hidden -isystem /usr/include/efi -isystem /usr/include/efi/ia32 -I /builddir/build/BUILD/systemd-stable-250.7/src/fundamental -DSD_BOOT -DGNU_EFI_USE_MS_ABI -include src/boot/efi/efi_config.h -include version.h -mno-sse -mno-mmx -flto -O2 -flto=auto ../src/fundamental/sha256.c: In function ‘sha256_finish_ctx’: ../src/fundamental/sha256.c:61:25: error: ‘false’ undeclared (first use in this function) 61 | # define UNALIGNED_P(p) false | ^~~~~ ../src/fundamental/sha256.c:136:21: note: in expansion of macro ‘UNALIGNED_P’ 136 | if (UNALIGNED_P(resbuf)) | ^~~~~~~~~~~ ../src/fundamental/sha256.c:32:1: note: ‘false’ is defined in header ‘<stdbool.h>’; did you forget to ‘#include <stdbool.h>’? 31 | #include "sha256.h" +++ |+#include <stdbool.h> 32 | ...
2022-06-02shared/utmp-wtmp: fix build without utmpChristian Hesse1-1/+1
Commit 16618332388442f2f1c3e52b0a9fde00121564a3 changed a function to add an extra argument. The data types used when building without utmp missed the change.
2022-06-02login: fix typoYu Watanabe1-2/+2
Follow-up for ea74f39c24344eafc238d1c69155bd5aca5f2e08.
2022-06-02boot: use CMP() macro for safetyYu Watanabe2-6/+9
2022-06-02boot: make several functions inlineYu Watanabe2-43/+29
Follow-ups for #23512.
2022-06-02boot: fix typoYu Watanabe1-1/+1
2022-06-02test: enable virtio-rng device for QEMU guestsFranck Bui1-0/+1
If rngd is included in the host initrd, QEMU guests need at least one source of entropy otherwise rngd will refuse to start. Hence this patch enables the virtio RNG device in QEMU guests (exposed as a HW RNG device available at /dev/hwrng). As a safety measure, the patch limits the data sent to the guest to 1KB per second in order to not let the guest starve the host entropy.
2022-06-02core: rework variable initialization to avoid gcc warningZbigniew Jędrzejewski-Szmek1-3/+3
In file included from ../src/basic/siphash24.h:11, from ../src/basic/hash-funcs.h:6, from ../src/basic/hashmap.h:8, from ../src/shared/fdset.h:6, from ../src/shared/bpf-program.h:9, from ../src/core/unit.h:11, from ../src/core/all-units.h:4, from ../src/core/manager.c:23: ../src/basic/time-util.h: In function 'manager_dispatch_jobs_in_progress': ../src/basic/time-util.h:140:38: error: 'x' may be used uninitialized [-Werror=maybe-uninitialized] 140 | #define FORMAT_TIMESPAN(t, accuracy) format_timespan((char[FORMAT_TIMESPAN_MAX]){}, FORMAT_TIMESPAN_MAX, t, accuracy) | ^~~~~~~~~~~~~~~ In function 'manager_print_jobs_in_progress', inlined from 'manager_dispatch_jobs_in_progress' at ../src/core/manager.c:3007:9: ../src/core/manager.c:219:18: note: 'x' was declared here 219 | uint64_t x; | ^ cc1: all warnings being treated as errors For some reason this (false positive) warning starts appearing after -ftrivial-auto-var-init is used.
2022-06-02man: add missing arguments to systemd-creds synopsisAntonio Alvarez Feijoo1-0/+2
2022-06-02core/bpf: prefix log messages from different bpf subsystemsZbigniew Jędrzejewski-Szmek5-95/+105
When something goes awry, we would get identical log messages from all the bpf subsystems. E.g. "Failed to load BPF object: %m" appeared 5 times in the sources. But it is very important to know *which* object we failed to load. This could be guessed, e.g. from surroudning messages or from filename/line metadata, but when we get log messages in bug reports, this might not be available. Let's make the messages distinguishable. While at it, some messages were adjusted a bit. In particular, we shouldn't use internal names like BPFProgram which have no meaning outside of the codebase.
2022-06-02core: define a helper function for basic bpf checksZbigniew Jędrzejewski-Szmek6-40/+57
2022-06-02test-socket-bind: fix commentZbigniew Jędrzejewski-Szmek1-2/+2
2022-06-02tests: drop pointless checks for rootZbigniew Jędrzejewski-Szmek3-9/+0
Testing the error paths is very important. If we are not root, we should try and get a failure, which we should report nicely and mark the test as skipped. After those checks are removed, this is what seems to happen. This way we can see what will happen e.g. in the user manager when we try to perform some bpf ops.
2022-06-02shared/bpf: install log callback and suppress most messages from libbpfZbigniew Jędrzejewski-Szmek2-3/+28
$ build/test-socket-bind ... libbpf: load bpf program failed: Operation not permitted libbpf: failed to load program 'sd_bind4' libbpf: failed to load object 'socket_bind_bpf' libbpf: failed to load BPF skeleton 'socket_bind_bpf': -1 Failed to load BPF object: Operation not permitted Now all lines with "libbpf:" are at debug level and will be hidden by default. Partially fixes https://bugzilla.redhat.com/show_bug.cgi?id=2084955#c14 (i.e. the error that was exposed when the initial error was fixed.)
2022-06-02meson: use files() for libcore_sources tooZbigniew Jędrzejewski-Szmek1-134/+134
C.f. f1b98127ff6320648cc3dc876f3b6a5aa3af204b.
2022-06-02userwork: use a better errno valueZbigniew Jędrzejewski-Szmek1-1/+1
ESRCH is literally "No such process".
2022-06-02various: add %m in messagesZbigniew Jędrzejewski-Szmek3-3/+3
Sometimes we want to suppress strerror() message because the are providing something better. But in those cases, it seems it was just forgotten.
2022-06-02test: fix indentationYu Watanabe1-45/+45
2022-06-02test: add test for sha256Yu Watanabe2-0/+52
2022-06-02sha256: use memcpy() when result buffer is unalignedYu Watanabe1-19/+20
Fixes #23578.
2022-06-02Documents the AssertCPUFeature= flag (#23594)Steve Ramage1-0/+1
Fixes #23593
2022-06-02Move basic/recovery-key.* to shared/Zbigniew Jędrzejewski-Szmek4-2/+2
No particular reason to have it in basic/. We should let homectl and other users share the single copy through libsystemd-shared.
2022-06-01resolved: choose correct file descriptor for proxy stub repliesBenjamin Franzke1-1/+1
find_socket_fd() does not expect the sender address, but the listen-address. This is in fact the destination of the DNS packet. Matching via sender address caused a fallback to the default stub listener in manager_dns_stub_fd() as the sender address can never match the proxy stub listen address. Note that manager_dns_stub_fd() is only used for the default listener stub and the proxy stub, that means *extra* listeners stubs (DNSStubListenerExtra=…) have not been affected as `struct DnsStubListenerExtra` provides a direct link to the event source. By using the correct fd we ensure the correct socket options (like TTL) are used and prevent issues like #23495 in case ifindex could not be determined.
2022-06-01build(deps): bump actions/upload-artifact from 2.3.1 to 3.1.0dependabot[bot]1-1/+1
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2.3.1 to 3.1.0. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/82c141cc518b40d92cc801eee768e7aafc9c2fa2...3cea5372237819ed00197afe530f5a7ea3e805c8) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01build(deps): bump github/super-linter from 4.9.3 to 4.9.4dependabot[bot]1-1/+1
Bumps [github/super-linter](https://github.com/github/super-linter) from 4.9.3 to 4.9.4. - [Release notes](https://github.com/github/super-linter/releases) - [Changelog](https://github.com/github/super-linter/blob/main/docs/release-process.md) - [Commits](https://github.com/github/super-linter/compare/431ee7836e8cdce5a460b0db682d9169563d919b...a320804d310fdeb8d1a46c6c6c1e615d443b10c9) --- updated-dependencies: - dependency-name: github/super-linter dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
2022-06-01src: The return value of server_vacuum () is not used and could be modified ↵Li kunyu2-4/+2
to void type
2022-06-01login: do not issue wall messages on local terminals for suspend and hibernateChristian Göttsche2-4/+14
Fixes: #23520 [zjs: I added the comment and tweaked the patch a bit. The call to reset_scheduled_shutdown() is moved down a bit to allow the callback to have access to information about the operation being cancelled. This all happens within the same function, so there should be no observable change in behaviour.]
2022-06-01shared/pager: print the name of the pager we'll try next in debug messageZbigniew Jędrzejewski-Szmek1-18/+17
I had a strange failure where the pager was hanging on invocation (gdm crashed and the kernel got into a strange state where it was hanging on some tasks). Based on the logs from 'SYSTEMCTL_LOG_LEVEL=debug journalctl', I couldn't even tell which pager binary we're executing. So let's shorten the function a bit and provide a bit more detail.
2022-06-01man/systemctl: improve grammar in description of --check-inhibitorsZbigniew Jędrzejewski-Szmek2-18/+16
2022-06-01systemctl: drop translation of method names to descriptions in error messageZbigniew Jędrzejewski-Szmek1-22/+19
We had yet-another table of descriptive strings to use in error messages. I started thinking how to synchronize them with the strings in logind, but ultimately I think it's better to remove those altogether. Those strings should almost never be used: normally if the call fails, logind will provide an error message itself, which is probably more detailed than what we can figure out on the client side. And the most important part that we want to show here is what exactly we called, in particular RebootWithFlags vs. Reboot, etc. By using the "descriptive strings" we were obfuscating this. So let's just simplify our code and print the actual method name, since this is more useful as an error statement that is googlable and unique. While at it, let's print the correct method name ;)
2022-06-01systemctl: make function staticZbigniew Jędrzejewski-Szmek2-11/+4
2022-06-01logind: reduce scope of a few variablesZbigniew Jędrzejewski-Szmek2-20/+16
2022-06-01logind: rework wall message about pending shutdown/halt/reboot/…Zbigniew Jędrzejewski-Szmek6-8/+26
Those messages simply *feel* dated: "The system is going for suspend NOW!". Let's say "The system will suspend|power off|hibernate|… now!" instead. The exclamation mark is enough to show the urgency. Also, the "the" seemed out of place. We're not talking about a specific reboot.
2022-05-31resolved: define source address for proxy-only stub repliesBenjamin Franzke1-3/+11
DnsPacket.ifindex=1 (loopback) is normalized to 0 whenever a message is received on the loopback iface, so for both listeners, 127.0.0.53 and 127.0.0.54, the ifindex will be set to 0 by manager_recv() for queries that have a local origin. Replies to such local messages need to set a proper ifindex in any case, as the supplied source-address would otherwise be ignored in manager_ipv4_send() (CMSG generation is skipped due to ifindex > 0 check). Note that this change only forces `ifindex` to loopback if it was actually normalized to `0` before (due to a loopback detection) in order to keep the nat-to-127.0.0.54-from-another-interface usecase that was described in a8d09063447568d87288a8e868fe386c1da7ce09 intact. Also note that nat is not supported for the main stub 127.0.0.53 which is why forcing LOOPBACK_IFINDEX was/is fine for that case. Fixes #23495
2022-05-31logind: do not print wall messages to local pseudoterminalsZbigniew Jędrzejewski-Szmek1-9/+7
Fixes #23520. Replaces #23555. The problem started with cdf370626f08ed509a5dde9d5618eed29d625032 and 90b1ec03b2ce939f589239133a32f4429f2ad6a6 which together started printing the wall message in more cases. The motivation for those change was reasonable, but this clearly causes problems described in #23520: users are getting unexpected wall messages. Xterm, urxvt, (anything using libutempter?), and tmux (in some configurations), register local pty sessions in utmp. So let's try to suppress the message for local pseudo-terminal logins. This patch based on #23538, but instead of filtering just on /dev/pts, it uses the .ut_addr_v6 to only filter out local entries.
2022-05-31tests: add a helper that dumps /run/utmp in detailZbigniew Jędrzejewski-Szmek2-0/+63
utmpdump doesn't print all the details. Looking at the list if useful when trying to tweak the wall filtering logic. This doesn't do much, but at least it serves as a smoke test for the cleanup functions.
2022-05-31test-network: call networkctl only when specified interface existsYu Watanabe1-2/+4
Otherwise, this easily trigger another exception: ``` ====================================================================== ERROR: test_erspan_tunnel_v0 (__main__.NetworkdNetDevTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "./test/test-network/systemd-networkd-tests.py", line 686, in wait_online check_output(*args, env=env) File "./test/test-network/systemd-networkd-tests.py", line 65, in check_output return subprocess.check_output(command, universal_newlines=True, **kwargs).rstrip() File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output **kwargs).stdout File "/usr/lib64/python3.6/subprocess.py", line 438, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['/usr/lib/systemd/systemd-networkd-wait-online', '--timeout=20s', '--interface=erspan99:routable', '--interface=erspan98:routable', '--interface=dummy98:degraded']' returned non-zero exit status 1. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "./test/test-network/systemd-networkd-tests.py", line 1808, in test_erspan_tunnel_v0 self.wait_online(['erspan99:routable', 'erspan98:routable', 'dummy98:degraded']) File "./test/test-network/systemd-networkd-tests.py", line 689, in wait_online output = check_output(*networkctl_cmd, '-n', '0', 'status', link.split(':')[0], env=env) File "./test/test-network/systemd-networkd-tests.py", line 65, in check_output return subprocess.check_output(command, universal_newlines=True, **kwargs).rstrip() File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output **kwargs).stdout File "/usr/lib64/python3.6/subprocess.py", line 438, in run output=stdout, stderr=stderr) subprocess.CalledProcessError: Command '['/usr/bin/networkctl', '-n', '0', 'status', 'erspan99']' returned non-zero exit status 1. ```
2022-05-31test-network: add tests for erspan version 0 and 2Yu Watanabe7-19/+168
2022-05-31network/erspan: support erspan version 0 and 2Yu Watanabe5-9/+207
This also makes networkd accepts erspan index 0. Closes #23570.