Commit graph

70485 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 320ff93265 journal-remote: use macro wrapper instead of alloca to extend string
We would use alloca to extend the format string with "\n". We do this
automatically in order to not forget appending the newline everywhere.
We can simplify the whole thing by using a macro to append the newline instead,
which means that we don't need to copy the string.

Because we concatenate the string argument with another literal string, we know
it must a literal string. Thus it's not a problem that it is "evaluated" two
times.

Quoting Hristo Venev:
> Since commit f5e757f1ce, mhd_respond() adds a
> newline to its argument before passing it on to mhd_respond_internal(). This
> is done via an alloca()-allocated buffer. However, MHD_RESPMEM_PERSISTENT is
> given as a flag to MHD_create_response_from_buffer(), leading to a
> use-after-free later when the response is sent. Replacing
> MHD_RESPMEM_PERSISTENT with MHD_RESPMEM_MUST_COPY appears to fix the issue.

MHD_RESPMEM_MUST_COPY would work, but we also use mhd_respond() for mhd_oom(),
and we don't want to allocate in an oom scenario in order to maximize the
possibility that an answer will be delivered. Using the macro magic makes this
nicer and we get rid of the code doing alloca.

Fixes an issue reported by Hristo Venev.
Fixes https://github.com/systemd/systemd/issues/9858.
2024-01-15 18:04:23 +01:00
Daan De Meyer 0e2f18eedd bus-socket: Clarify that inotify is supposed to watch all components
The previous wording of the components could mean that we should only
watch directories, not the socket itself. Reword so that we clearly
mention that all components of the path are watched, including the
socket itself.
2024-01-15 17:00:04 +00:00
Ludwig Nussel ec9ff6ea94 kernel-install: silence num kernels installed 2024-01-15 17:16:37 +01:00
Ludwig Nussel 27d420f466 kernel-install: fix context_copy
Don't reopen or dup values that weren't set before. Fixes add-all.
2024-01-15 17:16:37 +01:00
Ludwig Nussel 5058bd7e1f strv: introduce strv_copy_unless_empty() 2024-01-15 17:16:37 +01:00
Luca Boccassi 01526fedef
Merge pull request #30934 from yuwata/network-introduce-route-nexthop
network/route: introduce RouteNextHop object
2024-01-15 14:41:58 +00:00
Antonio Alvarez Feijoo b551a687a4 systemctl-is-system-running: display "offline" with --image
With the `--image` option, the `running_in_chroot` check is not enough. E.g.:

```
> build/systemctl --image /tmp/20240108-openSUSE.raw is-system-running
running
```
2024-01-15 11:58:38 +00:00
Yu Watanabe a663ddc04e test-network: add simple test case for DHCP relay on bridge interface
For issue #30763.
2024-01-15 10:53:07 +00:00
Yu Watanabe 3db1e6a874 resolve: on_transaction_stream_error() may free multiple transactions
Fixes #30928.
2024-01-15 10:36:14 +00:00
Luca Boccassi af8d919dcb
Merge pull request #30933 from YHNdnzj/sleep-trivial-cleanup
Trivial cleanup for systemd-sleep unit/man page
2024-01-15 10:15:12 +00:00
Luca Boccassi dd3f119b98
Merge pull request #30936 from yuwata/network-automatically-reconfigure-interface-on-failure
network: automatically reconfigure interface on failure
2024-01-15 10:09:30 +00:00
Yu Watanabe 6d1cea7bc6 test-network: try to flip interface state frequently 2024-01-15 15:46:33 +09:00
Yu Watanabe c2eb7753dd network/link: automatically reconfigure interface on failure
Closes #29246.
2024-01-15 15:46:33 +09:00
Yu Watanabe 24b9c341ce network/link: shorten code a bit 2024-01-15 15:46:33 +09:00
Yu Watanabe 13efe0ab11 network/route: do not read RTA_OIF twice
It is also read in route_nexthops_read_netlink_message(), and already
stored in the Route object. Let's use it.
2024-01-15 10:28:25 +09:00
Yu Watanabe b9e1caf64a network/route-nexthop: store ifindex of the assigned interface in Route.nexthop.ifindex
And use it if set on building netlink message.
2024-01-15 10:28:25 +09:00
Yu Watanabe 054b8c2817 network/route: also use RouteNextHop for managing gateway
No functional change, just refactoring.
2024-01-15 10:28:25 +09:00
Yu Watanabe fea879cd04 network/route-nexthop: introduce struct RouteNextHop and replace MultipathRoute with it
It is mostly equivalent to MultipathRoute. So, no functional change,
just refactoring and preparation for later commits.
2024-01-15 10:28:25 +09:00
Luca Boccassi 0f6a6e2f2b test: create /run/sshd in TEST-74-AUX-UTILS
12264s [ 4819.948632] sshd[1365]: fatal: Missing privilege separation directory: /run/sshd
12264s [ 4819.952120] testsuite-74.sh[1362]: kex_exchange_identification: read: Connection reset by peer
12264s [ 4819.952120] testsuite-74.sh[1362]: Connection reset by /run/ssh-unix-local/socket port 0

https://autopkgtest.ubuntu.com/results/autopkgtest-jammy-upstream-systemd-ci-systemd-ci/jammy/amd64/s/systemd-upstream/20240113_093341_50fc7@/log.gz

We copy binaries manually so some setups are missing, create the directory
as needed
2024-01-15 10:28:05 +09:00
Mike Yuan f2723ca745
man/systemd-sleep.conf: document the operation of s2h more thoroughly 2024-01-15 03:05:25 +08:00
Mike Yuan 22b21b2ea2
units: update Description= for systemd-sleep units 2024-01-15 02:59:25 +08:00
Mike Yuan ad0b7e03db
battery-util: raise log level for battery_is_discharging_and_low 2024-01-15 02:57:44 +08:00
Luca Boccassi 489864d3e9
Merge pull request #30932 from yuwata/network-route-split-out-more
network/route: split out more functions to networkd-route-nexthop.[ch]
2024-01-14 13:03:45 +00:00
Cristian Rodríguez 2a9ab0974b Fix gcc14 -Wcalloc-transposed-args warnings
all functions annotated with two parameter _alloc_ are calloc-like.
gcc14 enforces this and warns if arguments are backwards.
2024-01-14 12:57:38 +00:00
Luca Boccassi 51c58a9521
Merge pull request #30927 from YHNdnzj/logind-action-job
logind-dbus: refuse multiple jobs in method_do_shutdown_or_sleep too
2024-01-14 12:56:42 +00:00
Mike Yuan 3eb8acda96
logind-dbus: refuse multiple jobs in method_do_shutdown_or_sleep too
Fixes #30917
2024-01-14 05:14:42 +08:00
Mike Yuan 1f4cb8c9cf
logind-dbus: minor modernization 2024-01-14 05:14:25 +08:00
Yu Watanabe a0ab69d062 network/route-nexthop: make multipath_route_get_link() take fallback link
No functional change, just refactoring.
2024-01-14 06:04:46 +09:00
Yu Watanabe fad2f72351 network/route-nexthop: do not update MultipathRoute object
A MultipathRoute object is always owned by a Network object, and the
interface matching with its name specified in a MultipathRoute= setting
may be removed, and re-added later with a different ifindex.
2024-01-14 06:04:46 +09:00
Yu Watanabe c23f957eb1 network/route-nexthop: split out route_nexthops_is_ready_to_configure()
No effective functionality changed, just refactoring and preparation for
later commits.
2024-01-14 06:04:46 +09:00
Yu Watanabe f47d38c6fc network/route-nexthop: split out route_nexthops_to_string()
And reorder elements shown in the debugging log.
No effective functionality changed, just refactoring.
2024-01-14 06:04:46 +09:00
Yu Watanabe 54f9fba5e6 network/route-nexthop: split out netlink message handling for route nexthops
No functional change, just refactoring and preparation for later
commits.
2024-01-14 06:04:23 +09:00
Yu Watanabe b24db7052e varlink/network: OnlineState may not be set
Follow-up for c5c74d85d3.

Fixes #30918.
2024-01-14 04:57:41 +09:00
Yu Watanabe 9957189a43
Merge pull request #30916 from yuwata/network-route-section-verify
network: several cleanups for verifying [Route] section
2024-01-14 04:57:05 +09:00
Yu Watanabe 4db8ccbb59 wireguard: verify routes configured in .netdev file
Then, scope and friends are correctly adjusted, and the behavior should
be matched when the same route is configured in .network file.
2024-01-13 10:10:32 +09:00
Yu Watanabe 0db96961b4 network/route: split out route_section_verify_nexthops()
No effective functional change, just refactoring and preparation for
later commits.
2024-01-13 10:10:32 +09:00
Yu Watanabe b9f29e9f52 network/route: relocate route_type_is_reject() and friends
No functional change, preparation for later commits.
2024-01-13 10:10:32 +09:00
Yu Watanabe b82697eb20
Merge pull request #30895 from yuwata/network-drop-object-even-on-fail
network: remove Address object even when we failed to remove relevant address
2024-01-13 09:03:07 +09:00
Luca Boccassi 10bebf26f3
Merge pull request #30902 from YHNdnzj/run-accounting
run: small improvements for accounting data output
2024-01-12 23:43:57 +00:00
Luca Boccassi f60c964535
Merge pull request #30897 from yuwata/network-route-expiration
network: several cleanups for route expiration handling
2024-01-12 23:32:12 +00:00
Luca Boccassi c9eb59e710
Merge pull request #30896 from yuwata/network-route-conf-parser
network: minor cleanups for conf parsers
2024-01-12 23:27:39 +00:00
Luca Boccassi b0c45a633a modprobe: set 'ifb numifbs=0' to avoid autocreating ifb0
Fixes https://github.com/systemd/systemd/issues/30913
2024-01-12 23:24:54 +00:00
Nick Rosbrook fec0d508a2 test: skip TEST-43-PRIVATEUSER-UNPRIV if unprivileged userns is restricted
With newer versions of AppArmor, unprivileged user namespace creation
may be restricted by default, in which case user manager instances will
not be able to apply PrivateUsers=yes (or the settings which require it).

This can be tested with the kernel.apparmor_restrict_unprivileged_userns
sysctl.
2024-01-13 06:55:04 +09:00
Yu Watanabe 7a10e25a41
Merge pull request #30908 from poettering/nsid
networkd: expose netns "nsid" together with inode id
2024-01-13 06:54:32 +09:00
Frantisek Sumsal db6406e97e network: fix 6rd tunnel link section name
Spotted randomly when going through CI logs:

systemd-udevd[658]: /usr/lib/systemd/network/80-6rd-tunnel.link:21: Unknown section 'Network'. Ignoring.

Follow-up for 658169e6d3.
2024-01-12 21:42:04 +00:00
Lennart Poettering 91b34c7641 networkd: expose the nsid in the GetNamespaceId() varlink call
Let's return both ids in the GetNamespaceID(), since they are pretty
much the same concept.
2024-01-12 21:43:34 +01:00
Lennart Poettering 535252dc26 networkd: expose nsid via dbus 2024-01-12 21:43:34 +01:00
Lennart Poettering fa2bc6f1d7 socket-util: add netns_get_nsid() helper to show nsid of netns 2024-01-12 21:43:34 +01:00
Lennart Poettering 1078628096 sd-netlink: hook up nsid APIs 2024-01-12 18:52:26 +01:00
Lennart Poettering 414ae39821
Merge pull request #30911 from poettering/vmspawn-tweaks
vmspawn: various clean-ups
2024-01-12 18:32:40 +01:00