Commit graph

72519 commits

Author SHA1 Message Date
Yu Watanabe 33cab1d4ef network/ndisc: introduce ndisc_request_router_route()
Then, make ndisc_request_route() generic and usable for configuring
routes based on both Router Advertisement and Redirect messages.

Note, ndisc_request_router() never set lifetime, so the dropped comment
in ndisc_request_redirect_route() is wrong.

No functional change, just refactoring.
2024-04-12 04:59:42 +09:00
Yu Watanabe 2e73aa507b network/ndisc: do not set per-route MTU and hop limit
Setting MTU announced in RA message to routes is problematic, as the
value may be larger than the device MTU (IFLA_MTU), and in such case the
route cannot be used.

These two properties are now set per-interface, and gracefully handled
such invalid cases. Hence not necessary to set them to each route.

Follow-up for #32195.
2024-04-12 04:59:38 +09:00
Antonio Alvarez Feijoo 3ec49af973 journal-remote: fix two minor memory leaks 2024-04-12 02:37:25 +08:00
Frantisek Sumsal fc49bf6041
Merge pull request #32228 from mrc0mmand/more-test-tweaks
A couple of follow-ups for #32189
2024-04-11 20:35:27 +02:00
Frantisek Sumsal 6d13aacaac test: make sd-journal-gatewayd tests even more debug-able
Unfortunately bfd30e8af6 is not enough and the test fails, that still
occasionally occur, don't provide enough information to see what's
wrong. Let's rework the test a little to improve this, namely:

  - redirect curl's output into a temporary file instead of piping it
    directly into the "check" expression; that way we can simply dump
    the temporary file when the test fails, providing potentially
    crucial information. We don't want to always dump everything to
    stdout, as some of the tests request an entire system journal (note
    that shell redirection instead of `curl -o file` is used
    intentionally, so the output file is always nuked first)
  - by dropping the pipes in curl commands we can re-enable pipefail
  - also, split some very long commands to multiple lines to (slightly)
    improve readability

Follow-up for bfd30e8af6.
2024-04-11 14:42:45 +02:00
Luca Boccassi 947143e897
Merge pull request #32215 from yuwata/network-ndisc-address-lifetime
network/ndisc: fix assignment of valid lifetime
2024-04-11 12:16:31 +01:00
Ludwig Nussel aadbe55925 creds: allow null when decrypting
pcrlock writes a credential file using null key. Make sure systemd-creds
can show the file
2024-04-11 12:15:32 +01:00
Daan De Meyer eff0a82534
Merge pull request #32216 from DaanDeMeyer/fix
journal-remote: Use sd_event_set_signal_exit()
2024-04-11 13:01:46 +02:00
Luca Boccassi a6f0f20eb3 README.md: link bug bounty program 2024-04-11 12:58:53 +02:00
dependabot[bot] 1fdafca718 build(deps): bump pkg/fedora from 2822a03 to 3f8c38e
Bumps pkg/fedora from `2822a03` to `3f8c38e`.

---
updated-dependencies:
- dependency-name: pkg/fedora
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-11 12:13:12 +02:00
Frantisek Sumsal 8d9cdb31f7 test: make the output of TEST-69 less painful to read
The logs from TEST-69 still contain a lot of unnecessary shell
metacharacters, so to make the output more readable let's just set
TERM=dumb, instead of having to strip everything semi-manually. Also,
move the related --background= tweak to TEST-69, since it's relevant
only for that particular test.

Follow-up for 8d4bfd38ed.
2024-04-11 11:35:17 +02:00
Daan De Meyer b50e9011d0 journal-remote: Use "event" instead of "events"
We use singular "event" everywhere else, so let's use it here as well.
2024-04-11 10:01:56 +02:00
Daan De Meyer dcd332ae00 journal-remote: Use sd_event_set_signal_exit()
This also fixes bugs in the previous code where we pass the server
object as userdata to sd_event_add_signal which means that sd-event
tries to use the value of the server pointer as its exit code when
a signal is triggered.
2024-04-11 10:01:16 +02:00
Yu Watanabe fc4a9c9ce6 test: PROJECT_FILE macro cannot be used in generated code
If the build directory is outside of the source tree, ASSERT_XYZ()
triggers the following warning:
===
[20/569] Compiling C object test-hashmap.p/meson-generated_.._src_test_test-hashmap-ordered.c.o
In file included from ../../home/watanabe/git/systemd/src/basic/macro.h:399,
                 from ../../home/watanabe/git/systemd/src/basic/alloc-util.h:10,
                 from src/test/test-hashmap-ordered.c:5:
src/test/test-hashmap-ordered.c: In function ‘test_ordered_hashmap_get’:
../../home/watanabe/git/systemd/src/basic/log.h:216:27: warning: offset ‘32’ outside bounds of constant string [-Warray-bounds=]
  216 |                         ? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../home/watanabe/git/systemd/src/basic/log.h:238:24: note: in expansion of macro ‘log_full_errno_zerook’
  238 |                 (void) log_full_errno_zerook(level, 0, fmt, ##__VA_ARGS__); \
      |                        ^~~~~~~~~~~~~~~~~~~~~
../../home/watanabe/git/systemd/src/basic/log.h:248:28: note: in expansion of macro ‘log_full’
  248 | #define log_error(...)     log_full(LOG_ERR,     __VA_ARGS__)
      |                            ^~~~~~~~
../../home/watanabe/git/systemd/src/shared/tests.h:251:25: note: in expansion of macro ‘log_error’
  251 |                         log_error("%s:%i: Assertion failed: expected \"%s\" to be NULL, but \"%p\" != NULL",    \
      |                         ^~~~~~~~~
src/test/test-hashmap-ordered.c:614:9: note: in expansion of macro ‘ASSERT_NULL’
  614 |         ASSERT_NULL(r);
      |         ^~~~~~~~~~~
===
2024-04-11 09:29:22 +02:00
Daan De Meyer 8e7c157387
Merge pull request #32210 from YHNdnzj/execcommand-done
core: modernize ExecCommand parsing and fix one memory leak
2024-04-11 09:26:37 +02:00
Yu Watanabe e42a74803a network/ndisc: fix updating valid lifetime of configured address
This makes the logic mostly follows RFC 4862 section 5.5.3 (e),
as draft-ietf-6man-slaac-renum-07 is deprecated.

Fixes #31449.
2024-04-11 15:56:01 +09:00
Yu Watanabe 2d4c9c42ac network/ndisc: set provider address in caller
Follow-up for 43d184682d.

No functional change, just refactoring.
2024-04-11 15:56:01 +09:00
Yu Watanabe 1ae891037e
Merge pull request #32202 from DaanDeMeyer/assert
tests: Improve assertion error messages
2024-04-11 09:51:49 +09:00
Luca Boccassi 798ea5c05a
Merge pull request #32181 from YHNdnzj/open-file
Some fixes/improvements for OpenFile=
2024-04-10 23:15:56 +01:00
Luca Boccassi d0ea800943
Merge pull request #32195 from yuwata/network-ndisc-mtu
network: several cleanups for IPv6 MTU
2024-04-10 23:12:21 +01:00
Luca Boccassi bf5e509840
Merge pull request #32166 from yuwata/network-rfc7217-dad
network: generate another address on conflict
2024-04-10 22:59:01 +01:00
Yu Watanabe 8e91738fe9 libsystemd-network: do not trigger assertion by sd_*_is_running() with NULL
If systemd is built with developer mode, previously they trigger
hard assertions. Even built with release mode, we should not log about
that. Let's silently accept NULL and return false.

Prompted by https://github.com/systemd/systemd/pull/32166#issuecomment-2044710151.
2024-04-10 22:53:55 +01:00
Luca Boccassi 6dfaa0edaf
Merge pull request #32204 from DaanDeMeyer/post-rewrite
git: Add post-rewrite hook that invokes git submodule update
2024-04-10 22:52:45 +01:00
Luca Boccassi af60f679a3
Merge pull request #32205 from YHNdnzj/bless-boot
Minor cleanup for bless-boot
2024-04-10 22:52:11 +01:00
Mike Yuan ee9895e295
core/dbus-execute: fix potential memory leak 2024-04-11 04:44:57 +08:00
Mike Yuan f09604b0a6
core/execute: introduce exec_command_free 2024-04-11 04:44:57 +08:00
Mike Yuan ccbb85a58b
core/dbus-execute: modernize a bit 2024-04-11 04:44:36 +08:00
Mike Yuan 21b366121f
core/load-fragment: modernize config_parse_exec 2024-04-11 04:44:35 +08:00
Daan De Meyer 5c041971eb docs: Add Tests section to coding style doc 2024-04-10 18:24:29 +02:00
Daan De Meyer 681e39c1dc Introduce ASSERT_OK_ERRNO()
ASSERT_OK() is for functions that return negative errno. Let's
introduce ASSERT_OK_ERRNO() for syscalls that return -1 and store
the error in errno.
2024-04-10 18:24:26 +02:00
Daan De Meyer 29b27d59d5 tests: Improve assertion error messages 2024-04-10 18:20:23 +02:00
Mike Yuan 40611863e4
units/systemd-boot-check-no-failures.service: drop unneeded dep on shutdown.target 2024-04-10 23:40:53 +08:00
Mike Yuan 6f801feb4b
bless-boot-generator: use generator_add_symlink 2024-04-10 23:40:53 +08:00
Mike Yuan 8b317c3400
core: use FOREACH_ARRAY at 3 more places 2024-04-10 23:40:53 +08:00
Ivan Kruglov 5152b8459a ASSERT_NULL/ASSERT_NOT_NULL 2024-04-10 16:57:30 +02:00
Frantisek Sumsal 0ab87ebd97
Merge pull request #32201 from aafeijoo-suse/test-minor-fixes
test: minor fixes
2024-04-10 16:54:37 +02:00
Mike Yuan 48c21790ba
test: merge TEST-77-OPENFILE into TEST-23-UNIT-FILE
And add coverage for #32179
2024-04-10 21:49:28 +08:00
Daan De Meyer f1e9e8041c git: Add post-rewrite hook that invokes git submodule update
git rebase does not support a --recurse-submodules switch to automatically
check out the submodules at their registered commits during or after a rebase.

Instead, let's use the post-rewrite git hook to do this ourselves.
2024-04-10 14:39:49 +02:00
Daan De Meyer 8bc9232636 Update submodules 2024-04-10 14:36:59 +02:00
Mike Yuan c1f9509f79
shared/open-file: use xescape to escape ':'
Fixes #32179
2024-04-10 20:16:35 +08:00
Mike Yuan 4eb1feb110
shared/open-file: make open_file_free_many static inline 2024-04-10 20:16:35 +08:00
Mike Yuan c642f43131
core/exec-invoke: modernize get_open_file_fd a bit 2024-04-10 20:16:35 +08:00
Mike Yuan 9b076e86c0
core/exec-invoke: modernize connect_unix_harder 2024-04-10 20:16:34 +08:00
Pablo Méndez Hernández ffd0cca34a man/journald: Add missing configuration files
The man page was missing:

-  `/run/systemd/journald.conf`
-  `/usr/lib/systemd/journald.conf`

as valid configuration files.

Fixes: https://github.com/systemd/systemd/issues/32199
2024-04-10 20:15:17 +08:00
Antonio Alvarez Feijoo 2ad44c22fe
tools/check-version-history: skip test if lxml is not installed
```
================================= 1070/1408 ==================================
test:         systemd:dist / check-version-history
start time:   07:55:05
duration:     0.03s
result:       exit status 1
...
----------------------------------- stderr -----------------------------------
Traceback (most recent call last):
  File "/mnt/work/systemd/upstream-fork/main/tools/check-version-history.py", line 6, in <module>
    import lxml.etree as tree
ModuleNotFoundError: No module named 'lxml'
==============================================================================
```

Follow-up for 3691e7fce7
2024-04-10 11:10:02 +02:00
Antonio Alvarez Feijoo 866a469e5a
test: add missing header to test.h
```
../src/shared/tests.h:361:28: error: implicit declaration of function ‘fork’ [-Werror=implicit-function-declaration]
  361 |                 int _pid = fork();                                                                              \
      |                            ^~~~
../src/test/test-macro.c:1114:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1114 |         ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/shared/tests.h:369:25: error: implicit declaration of function ‘_exit’ [-Werror=implicit-function-declaration]
  369 |                         _exit(EXIT_SUCCESS);                                                                    \
      |                         ^~~~~
../src/test/test-macro.c:1114:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1114 |         ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/shared/tests.h:369:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
  369 |                         _exit(EXIT_SUCCESS);                                                                    \
      |                         ^~~~~
../src/test/test-macro.c:1114:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1114 |         ASSERT_SIGNAL(ASSERT_OK(-1), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/shared/tests.h:369:25: warning: incompatible implicit declaration of built-in function ‘_exit’ [-Wbuiltin-declaration-mismatch]
  369 |                         _exit(EXIT_SUCCESS);                                                                    \
      |                         ^~~~~
../src/test/test-macro.c:1115:9: note: in expansion of macro ‘ASSERT_SIGNAL’
 1115 |         ASSERT_SIGNAL(ASSERT_OK(-ENOANO), SIGABRT);
      |         ^~~~~~~~~~~~~
../src/test/test-macro.c:1119:21: error: implicit declaration of function ‘getpid’; did you mean ‘getpt’? [-Werror=implicit-function-declaration]
 1119 |         ASSERT_TRUE(getpid());
      |                     ^~~~~~
```

Follow-up for #32189
2024-04-10 11:09:52 +02:00
Lennart Poettering 5538b62f59 secure-boot: tighten enrollment logic a bit regarding file sizes
It's OK the dbx file is not loaded, but let's explicitly check for that
(i.e. if the buffer is actually non-NULL), rather than the size of the
bufer, since empty files actually do exist.

Or in other words, let's not magically suppress enrollment of empty
files, but let uefi firmware handle these on their own.

Follow-up for: 57ea8012d6
2024-04-10 16:59:37 +09:00
Lennart Poettering 6fea0f0ba0 boot: re-align table
We like our tables aligned.

(Also suppres the final two fields, which are all zeroes anyway, to
declutter a bit)
2024-04-10 16:59:37 +09:00
Lennart Poettering 3ee27b2580 resolved: dns_name_equal() can fail, handle that reasonably
Ignoring errors can be OK sometimes, but we should make this explicit.
2024-04-10 16:58:34 +09:00
Yu Watanabe cd226becd8
Merge pull request #32189 from mrc0mmand/test-tweaks
Another batch of assorted test tweaks
2024-04-10 16:57:00 +09:00