Commit Graph

58171 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
84dbb3fd83 basic/in-addr-util: add IN_ADDR_TO_STRING
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-06 09:52:52 +02:00
Zbigniew Jędrzejewski-Szmek
b547241728 shared/microhttp-util: silence gcc warning
../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-05 15:57:39 +00:00
Daan De Meyer
c9bd01ae90 meson: Switch default-locale default to C.UTF-8
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-04 05:08:37 +09:00
Zbigniew Jędrzejewski-Szmek
ea4f2d5fb7 core: suppress message about missing libbpf if in initrd()
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-04 03:20:47 +09:00
Antonio Alvarez Feijoo
d48cfc98eb cryptenroll: fix typo 2022-06-03 17:27:22 +02:00
Zbigniew Jędrzejewski-Szmek
3a2a0806f5 Merge pull request #23297 from medhefgo/trivial-auto-var-init
meson: Compile with -ftrivial-auto-var-init
2022-06-03 15:27:51 +02:00
Yu Watanabe
a71278840b test: add dlopen test for pam_systemd_home 2022-06-03 13:40:14 +01:00
Zbigniew Jędrzejewski-Szmek
38c87ca2ab sha256: fix compilation on efi-ia32
/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-03 19:09:54 +09:00
Yu Watanabe
311f57a402 Merge pull request #23583 from yuwata/boot-efi-string-follow-ups
boot: follow-ups for efi-string functions
2022-06-03 10:23:24 +09:00
Christian Hesse
d6e2c2d34d shared/utmp-wtmp: fix build without utmp
Commit 1661833238 changed a function to
add an extra argument. The data types used when building without utmp
missed the change.
2022-06-03 05:00:50 +09:00
Yu Watanabe
0a11366280 login: fix typo
Follow-up for ea74f39c24.
2022-06-03 04:28:01 +09:00
Yu Watanabe
095e173a04 boot: use CMP() macro for safety 2022-06-03 04:20:46 +09:00
Yu Watanabe
42e785d096 boot: make several functions inline
Follow-ups for #23512.
2022-06-03 04:20:46 +09:00
Yu Watanabe
a54e635d02 boot: fix typo 2022-06-03 04:20:46 +09:00
Zbigniew Jędrzejewski-Szmek
e78bd91e55 Merge pull request #23596 from keszybz/bpf-messages-more
Silence messages from libbpf
2022-06-02 19:48:01 +02:00
Franck Bui
4d5d28e9a6 test: enable virtio-rng device for QEMU guests
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-03 01:52:28 +09:00
Zbigniew Jędrzejewski-Szmek
4c989f89b6 core: rework variable initialization to avoid gcc warning
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-02 17:31:55 +02:00
Zbigniew Jędrzejewski-Szmek
6a9f3cef8c Merge pull request #23576 from yuwata/network-erspan-version
network: support erspan version 0 and 2
2022-06-02 16:58:55 +02:00
Zbigniew Jędrzejewski-Szmek
7e5c7522e8 Merge pull request #23579 from yuwata/sha256-unaligned
sha256: use memcpy() to accept unaligned result buffer
2022-06-02 16:38:19 +02:00
Antonio Alvarez Feijoo
5ad0109cd8 man: add missing arguments to systemd-creds synopsis 2022-06-02 16:35:36 +02:00
Zbigniew Jędrzejewski-Szmek
d7cf4ba6f3 Merge pull request #23582 from bnf/dns-proxy-stub-ifindex
resolved: define source address for proxy-only stub replies
2022-06-02 16:34:55 +02:00
Zbigniew Jędrzejewski-Szmek
b1acbc08e2 core/bpf: prefix log messages from different bpf subsystems
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-02 15:59:41 +02:00
Zbigniew Jędrzejewski-Szmek
bb0b01ed20 core: define a helper function for basic bpf checks 2022-06-02 15:59:41 +02:00
Zbigniew Jędrzejewski-Szmek
62b045b45c test-socket-bind: fix comment 2022-06-02 10:48:31 +02:00
Zbigniew Jędrzejewski-Szmek
b1fdcda876 tests: drop pointless checks for root
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-02 10:48:31 +02:00