Commit graph

39021 commits

Author SHA1 Message Date
Yu Watanabe 46355675f7
Merge pull request #23774 from yuwata/netlabel-nftset-follow-ups
network, core: revert NFTSet and NetLabel features
2022-06-23 01:33:19 +09:00
Zbigniew Jędrzejewski-Szmek a7b2aa658f
Merge pull request #23806 from keszybz/udevadm-info-pager
Pager for udevadm info
2022-06-22 16:50:53 +02:00
Yu Watanabe a32badc5a6 Revert "networkd: NetLabel integration"
This reverts PR #23269 and its follow-up commit. Especially,
2299b1cae3 (partially), and
3cf63830ac.

The PR was merged without final approval, and has several issues:
- The NetLabel for static addresses are not assigned, as labels are
  stored in the Address objects managed by Network, instead of Link.
- If NetLabel is specified for a static address, then the address
  section will be invalid and the address will not be configured,
- It should be implemented with Request object,
- There is no test about the feature.
2022-06-22 22:34:26 +09:00
Yu Watanabe b48ed70c79 Revert NFTSet feature
This reverts PR #22587 and its follow-up commit. More specifically,
2299b1cae3 (partially),
e176f85527,
ceb46a31a0, and
51bb9076ab.

The PR was merged without final approval, and has several issues:
- OSS fuzz reported issues in the conf parser,
- It calls synchrnous netlink call, it should not be especially in PID1,
- The importance of NFTSet for CGroup and DynamicUser may be
  questionable, at least, there was no justification PID1 should support
  it.
- For networkd, it should be implemented with Request object,
- There is no test for the feature.

Fixes #23711.
Fixes #23717.
Fixes #23719.
Fixes #23720.
Fixes #23721.
Fixes #23759.
2022-06-22 22:23:58 +09:00
Zbigniew Jędrzejewski-Szmek cbef829f80 udevadm info: use pager for all output types
Before we used the pager for --tree, but not e.g. for --export-db.
I don't see any particular reason to limit this.
2022-06-22 14:31:43 +02:00
Zbigniew Jędrzejewski-Szmek b6ec23a01a udevadm info: implement --no-pager 2022-06-22 14:31:42 +02:00
Yu Watanabe 82d7a151db core: close watchdog device if watchdog device is unspecified now
If a watchdog device was specified previously, and unspecified later and
PID1 is reloaded, then we need to close the device.
2022-06-22 16:23:36 +09:00
Yu Watanabe e83c4d178b core: drop unnecessary free
As reset_arguments() frees the string.

Follow-up for 919ea64f69.
2022-06-22 16:21:06 +09:00
Vishal Chillara Srinivas 127b26f3d8 resolve: mDNS transaction max attempts fix
Maximum attempts to send mDNS requests is one except for probe requests, which should be attempted thrice.
Implemented fix to account for the difference between regular queries and probe requests, and prevent
even regular queries from being attempted thrice.
See RFC 6762 Section 8.1
2022-06-22 16:04:55 +09:00
Łukasz Stelmach 919ea64f69 core: Fix memory leaks
arg_early_core_pattern and arg_watchdog_device hold pointers to memory
allocated with strdup() (inside path_make_absolute_cwd). The memory needs
to be freed in reset_arguments() during reload rather than forgotten.
2022-06-22 01:31:17 +01:00
Pavel Zhukov 19df770fe1 Add sys/file.h for LOCK_
Fixes build with musl:
| ../git/src/shared/dissect-image.c: In function 'mount_image_privately_interactively':
| ../git/src/shared/dissect-image.c:2986:34: error: 'LOCK_SH' undeclared (first use in this function)
|  2986 |         r = loop_device_flock(d, LOCK_SH);
|       |                                  ^~~~~~~
2022-06-21 16:07:58 +01:00
Zbigniew Jędrzejewski-Szmek 107795a759 pkgconfig,rpm: expose vars for user-tmpfiles.d location
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2098553.
2022-06-21 15:49:41 +09:00
Yu Watanabe e83cfbf972 locale: drop unnecessary allocation
Fixes a bug introduced by 3d36b5d7e7.

Fixes #23777.
2022-06-18 14:46:45 +01:00
Marc Kleine-Budde 25ed7633b1 networkctl: fix output of "status": replace "Queue Length" by "Number of Queues"
Commit 0307afc681 ("networkctl: add support to display Transmit/Recieve queue
length (#12633)") added the display of the number of RX and TX Queues to the
output of `networkctl status $DEV`. However the row description says "Queue
Length".

This patch fixes the output by replacing "Queue Length" by "Number of Queues".

Fixes: 0307afc681 ("networkctl: add support to display Transmit/Recieve queue length (#12633)")
2022-06-18 10:44:42 +09:00
Philipp Gortan 2751ad9c3f add program name to log line 2022-06-18 10:43:03 +09:00
Luca Boccassi 9dd98db27d
Merge pull request #23756 from yuwata/analyze-seccomp-filter
analyze: fix seccomp filter handling in security command
2022-06-17 09:58:14 +01:00
Jan Janssen 01d81c126b meson: Reorder cflags for sd-boot
Currently, -Wall and -Wextra override previously passed flags like
-Wno-unused-parameter. This reorders them to be passed before any
optional flags. -Wsign-compare is part of -Wextra and therefore dropped.
-nostdlib is a link-stage flag and dropped as it is already part of
efi_ldflags.
2022-06-17 12:57:41 +09:00
Yu Watanabe 6d6a08547c seccomp-util: make @known include @obsolete
@known is generated from syscall-list.txt, which generated from kernel
headers. So, some syscalls in @obsolete may not be listed in
syscall-list.txt.
2022-06-17 12:40:43 +09:00
Yu Watanabe 5862e5561c analyze-security: always save syscall name
This reverts dd51e725df and fixes bugs
introduced by 1624114d74.

Previously,
- On online scan, the syscall filter was a string Hashmap, but it
  might contain syscall name with errno or error action. Hence, we need
  to drop the errno or error action in the string.
- On offline scan, the syscall filter was a Hashmap of syscall ID, so
  hashmap_contains() with syscall name did not work. We need to convert
  syscall IDs to syscall names.
- If hashmap_contains() in syscall_names_in_filter() is true, then
  the syscall is allowed when the list is an allow-list, and vice versa.
  Hence, the condition in syscall_names_in_filter() was errnously
  inverted by dd51e725df.

This makes syscalls are always stored with its name, instead of ID,
and also correct the condition.

Fixes #23663.
2022-06-17 12:37:56 +09:00
Yu Watanabe cb649d12bf set: introduce set_put_strndup()
Note, if `n != SIZE_MAX`, we cannot check the existence of the specified
string in the set without duplicating the string. And, set_consume() also
checks the existence of the string. Hence, it is not necessary to call
set_contains() if `n != SIZE_MAX`.
2022-06-17 12:28:36 +09:00
Yu Watanabe 1008d415e7 core/dbus-execute: drop unnecessary flag
The code block is called only when the list was empty, and the newly
requested list is allow-list. Hence, invert_flag is always zero here.
2022-06-17 12:26:50 +09:00
Yu Watanabe 8c93ebbdf0 core/dbus-execute: do not append denied syscalls in allow-list
Follow-up for 68acc1afbe.

Before the commit, SystemCallFilter bus property provides only allowed
syscalls if ExecContext.syscall_filter is an allow-list, and vice versa.

After the commit, if the list is allow-list, it contains allowed
syscalls with value `-1`, and denied syscalls with non-negative values.

To keep the backward compatibility, denied syscalls must be dropped in
SystemCallFilter bus property.
2022-06-17 12:19:39 +09:00
Yu Watanabe 05ab439a62 nspawn: fix UID map string
We send/recv the set of payload uid, host uid, payload gid, host gid.
Hence, the index must be incremented with 4, instead of 2.

Fixes #23664.
2022-06-16 11:52:59 +09:00
Vishal Chillara Srinivas f941c12427 RFC 6762 section 7.1: a Multicast DNS querier SHOULD NOT include records in the
Known-Answer list whose remaining TTL is less than half of their original TTL
2022-06-16 10:44:25 +09:00
Vishal Chillara Srinivas 82af03c223 resolve: mark mDNS RRs in the Additional Records section as cacheable
RFC 6762 does not restrict caching of records in the Additional section.
Caching can improve resolve efficiency.
2022-06-16 10:44:07 +09:00
Yu Watanabe eed6ee82df
Merge pull request #23733 from sshedi/cid-1469711
homework: initialize we_detached
2022-06-15 12:03:24 +09:00
Yu Watanabe 4589c1d734
Merge pull request #23709 from yuwata/test-hostname-locale
test: import hostname and locale tests from debian/ubuntu test suite
2022-06-15 12:00:22 +09:00
Shreenidhi Shedi c9f5ac0917 sd-journal: check retval of sd_id128_from_string call
Fixes: CID#1469712

CID 1469712 (#1 of 1): Unused value (UNUSED_VALUE)
returned_value: Assigning value from sd_id128_from_string(word + 2, &boot_id) to r here,
but that stored value is overwritten before it can be used.
2022-06-14 17:52:48 +05:30
Shreenidhi Shedi 2f4ad53549 homework: initialize we_detached
Fixes: CID#1469711

CID 1469711 (#1 of 1): Uninitialized scalar variable (UNINIT)
14. uninit_use: Using uninitialized value we_detached.
2022-06-14 17:52:46 +05:30
Yu Watanabe 2b1eb5f871 localectl: use Table to show status 2022-06-14 20:56:23 +09:00
Yu Watanabe 3e5203b3eb locale: rename keymap-util.[ch] -> localed-util.[ch]
As the file contains not only keymap related functions.
2022-06-14 20:56:23 +09:00
Yu Watanabe 3d36b5d7e7 locale-setup: merge locale handling in PID1 and localed 2022-06-14 20:56:23 +09:00
Yu Watanabe d2e96a4f87 locale-util: align locale entries 2022-06-14 20:56:23 +09:00
Yu Watanabe a2f7937747 locale-util: check if enumerated locales are valid 2022-06-14 20:56:23 +09:00
Yu Watanabe 065058e63b locale-util: fix memleak on failure 2022-06-14 20:56:23 +09:00
Christian Göttsche 1805fbcf06 sysctl: increase log severity on failed write
Increase the log severity in case of writing to a non existent sysctl
parameter as this can either be caused by a misspelling or a kernel mis-
configuration, e.g. in case YAMA does not get loaded due to a incomplete
lsm= override:

    systemd-sysctl[354]: Couldn't write '1' to 'kernel/yama/ptrace_scope', ignoring: No such file or directory
2022-06-14 09:29:37 +09:00
Shreenidhi Shedi a4433b4532 network: l2tp: initialize a to NULL
Fixes: CID#1475788
2022-06-13 08:41:52 +09:00
Zbigniew Jędrzejewski-Szmek ef55efe823
Merge pull request #23707 from yuwata/dns_service_split
dns-domain: fix buffer-overflow
2022-06-12 11:37:20 +02:00
Luca Boccassi 039f1673e9 meson: add build targets for libudev, libsystemd and pkg-config
Mirror install tags with the same names and content
2022-06-12 13:13:49 +09:00
Yu Watanabe 0ffc372a1d shared/linux: update kernel headers to 5.19-rc1 2022-06-11 06:50:12 +09:00
Yu Watanabe 7d9a2c0aa6 basic/linux: update kernel headers to 5.19-rc1 2022-06-11 06:49:42 +09:00
Yu Watanabe 3c4ae50abe dns-domain: reduce indentation in dns_service_split() 2022-06-11 06:02:08 +09:00
Yu Watanabe ec4c01475e dns-domain: rename function arguments 2022-06-11 06:01:48 +09:00
Yu Watanabe 9db01ca5b0 dns-domain: make each label nul-terminated
dns_label_unescape() does not nul-terminate the buffer if it does not
have enough space. Hence, if a lable is enough long, then strjoin()
triggers buffer-overflow.

Fixes #23705.
2022-06-11 06:01:46 +09:00
Yu Watanabe 288bafa952
Merge pull request #23691 from medhefgo/efi-clang
efi: Add parse_number8/16
2022-06-11 05:01:24 +09:00
Elias Probst 4218f81d83 systemctl: add edit verb to arguments' help text
The arguments `--global`, `--runtime` and `--root` also affect the
`edit` verb.
2022-06-11 04:43:42 +09:00
Yu Watanabe 3e808e0769
Merge pull request #23701 from medhefgo/boot-mem
boot: Use memcpy/memset provided by firmware
2022-06-11 04:29:27 +09:00
Shreenidhi Shedi 1dea9f1268 boot: use efi_memcpy inplace of memcpy
`efi_memcpy` does some validations before referencing pointers, it is
the safer option for this case.

Fixes: CID#1489876
2022-06-11 04:25:35 +09:00
Zbigniew Jędrzejewski-Szmek a61473bde5 shared/condition: accept size suffixes for ConditionMemory
Fixes #23697.
2022-06-10 19:50:59 +01:00
Luca Boccassi e48bc49271
Merge pull request #23687 from yuwata/dns-domain-trivial-cleanups
dns-domain: trivial cleanups
2022-06-10 19:50:22 +01:00
Frantisek Sumsal bf24eafcd2
Merge pull request #23584 from yuwata/test-login
test: import logind test from debian/ubuntu test suite
2022-06-10 14:50:35 +00:00
Frantisek Sumsal a359237fb7
Merge pull request #23690 from yuwata/test-sd-device
test: several tweaks for test-sd-device
2022-06-10 14:50:01 +00:00
Jan Janssen 8494bd1ced boot: Use memcpy/memset provided by firmware
These are significantly faster and safe us from rolling our own
optimized versions.
2022-06-10 15:54:06 +02:00
Jan Janssen 2b0af8e76a boot: Mark memcmp/memcpy/memset aliases as used
The compiler may emit calls to these but also optimize the function away
somehow, breaking at link stage. Marking them as used prevents this.
2022-06-10 15:54:02 +02:00
Jan Janssen f23b2a04e6 efi-string: Remove one more |= for bool
This one was missed in #23589.
2022-06-10 14:14:57 +02:00
James Hilliard 76abad4d47 meson: add experimental bpf-gcc compiler support
Not fully working but should make it easier to clean up remaining
issues.
2022-06-10 14:01:19 +02:00
Jan Janssen 153381952b boot: Use parse_number16 for boot counter parsing 2022-06-10 11:50:13 +02:00
Jan Janssen 1621ab4600 boot: Drop use of Atoi 2022-06-10 11:50:13 +02:00
Jan Janssen 72bd3458e5 boot: Add parse_number8/16 2022-06-10 11:50:13 +02:00
Yu Watanabe 3284dd9159 test: exclude network interfaces
After https://github.com/systemd/systemd-centos-ci/pull/492 is merged,
the networkd test may be running when test-sd-device is invoked.
Let's exclude net subsystem.
2022-06-10 18:44:21 +09:00
Yu Watanabe f9e090b16d test: always exclude devices named loop*
Not only block subsystem, but also misc has device named "loop*", and
the test always said that the following device is newly found:
---
/* test_sd_device_enumerator_filter_subsystem */
New device found: subsystem:misc syspath:/sys/devices/virtual/misc/loop-control
1 new devices are found in re-scan
---
2022-06-10 15:36:21 +09:00
Yu Watanabe da5fb1877d boot/efi-string: check the end of haystack before testing remaining pattern
Fixes buffer-overflow reported at https://github.com/systemd/systemd/pull/23589#issuecomment-1151820341.
2022-06-10 12:05:38 +09:00
Yu Watanabe c07eb49aff devnode-acl: use set_put_strdup_full() and set_ensure_consume() 2022-06-10 10:47:25 +09:00
Yu Watanabe 47484dd955 dns-domain: simplify code a bit 2022-06-10 09:49:07 +09:00
Yu Watanabe 8d896617b4 dns-domain: use dns_name_concat()
`dns_name_normalize()` is an alias of `dns_name_concat()`.
For consistency with `dns_name_is_valid_ldh()`, let's use
`dns_name_concat()`.
2022-06-10 09:42:33 +09:00
Yu Watanabe 8bf796eeac
Merge pull request #23589 from medhefgo/efi-clang
boot: Drop use of several gnu-efi functions
2022-06-10 08:54:48 +09:00
i-do-cpp 67225a96e5 fix: sd_id128_get_invocation now works for user services 2022-06-10 08:28:37 +09:00
Yu Watanabe 74223cbe14 tree-wide: fix typo 2022-06-10 08:26:08 +09:00
Frantisek Sumsal 894dad2975 test: account for ADDR_NO_RANDOMIZE if it's set
On ppc64le sanitizers disable ASLR (i.e. by setting ADDR_NO_RANDOMIZE),
which opinionated_personality() doesn't return. Let's tweak the current
personality ourselves in such cases.

See: 78f7a6eaa6

Resolves: #23666
2022-06-10 05:34:01 +09:00
Yu Watanabe 677ec2d609
Merge pull request #23348 from medhefgo/log-shutdown-blockers
shutdown: Log processes that block umount
2022-06-10 05:33:37 +09:00
Luca Boccassi 9c3e2a2a97
Merge pull request #23658 from keszybz/gcc-warnings-2
Fixes for NULL-pointer arguments based on gcc warnings
2022-06-09 17:48:09 +01:00
James Hilliard 9b948bc062 bpf: use __always_inline macro in restrict-ifaces.bpf.c
This appears to be more reliable at inlining with some compilers.
2022-06-09 17:45:11 +01:00
Jan Janssen df48b430a4 shutdown: Lazy unmount /oldroot/{dev,proc,sys}
These should not prevent us from cleaning up the remainders of /oldroot
if something in the kernel is blocking these from being unmounted.
2022-06-09 17:02:50 +02:00
Jan Janssen 20596876e3 shutdown: Log processes that block umount 2022-06-09 17:00:46 +02:00
Jan Janssen 5125b67742 shutdown: Rename umount_log_level and make it a bool
This was already effectively a bool because only ever two states were
valid. To make the meaning of it more clear, also rename it to last_try.
2022-06-09 16:50:54 +02:00
Zbigniew Jędrzejewski-Szmek c4da8e90fa systemctl: simplify code a bit
gcc insists that bus may be used unitialized here, but I don't see any
possibility of that.
2022-06-09 13:25:17 +02:00
Zbigniew Jędrzejewski-Szmek c90821aa49 shared/bus-util: rename variables to follow newer style 2022-06-09 13:25:17 +02:00
Zbigniew Jędrzejewski-Szmek 73e910926e shared/bus-util: simplification 2022-06-09 13:25:17 +02:00
Zbigniew Jędrzejewski-Szmek 482dac9431 test-udev-util: do not pass NULL to printf, style fixes 2022-06-09 13:25:17 +02:00
Zbigniew Jędrzejewski-Szmek fa1aa468b9 test-process-util: do not pass NULL to printf, simplify tests
We don't need to fork to test that the function returns -EINVAL
on null input. So let's simplify things a bit.
2022-06-09 13:25:17 +02:00
Zbigniew Jędrzejewski-Szmek e9edf285db test-dns-domain: a few more "NULL in printf %s"s 2022-06-09 13:25:17 +02:00
Zbigniew Jędrzejewski-Szmek d10cee5e90 test-fstab-util: one more "NULL in printf %s" 2022-06-09 13:25:17 +02:00
Zbigniew Jędrzejewski-Szmek 8b98cfb7dd various: indentation 2022-06-09 13:25:17 +02:00
Zbigniew Jędrzejewski-Szmek a78af10ae7
Merge pull request #23654 from keszybz/gcc-warnings
Fixes for NULL-pointer arguments based on gcc warnings
2022-06-09 12:55:47 +02:00
Jan Janssen 55233913c8 boot: Drop use of DuplicateDevicePath 2022-06-09 12:50:13 +02:00
Jan Janssen e17fd5538f boot: Don't copy device path
BS->LocateDevicePath only advances the passed device path pointer.
It does not actually modify it, so there is no need to make a copy.
2022-06-09 12:50:13 +02:00
Jan Janssen b05d69ed72 boot: Drop use of LibLocateHandle 2022-06-09 12:50:13 +02:00
Jan Janssen b04f818417 boot: Drop use of UnpackDevicePath
Device paths are a packed data structure and the UEFI spec is clear that
members may be misaligned.

In this case all accesses are aligned except for the signature. We can
simply memcpy it instead of making a whole (aligned) copy of the device
path.
2022-06-09 12:50:13 +02:00
Jan Janssen 79a2b916a0 boot: Drop use of FileDevicePath 2022-06-09 12:50:13 +02:00
Jan Janssen 0af26643d0 boot: Use xmalloc
This drops the unused xnew0 and xallocate_zero_pool as there is only two
users of it. _cleanup_freepool_ will be phased out once the types in the
declarations are changed/renamed.
2022-06-09 12:50:13 +02:00
Jan Janssen 9148312fab boot: Add xmalloc 2022-06-09 12:50:13 +02:00
Jan Janssen 5594ebee99 boot: Drop use of DevicePathFromHandle 2022-06-09 12:50:13 +02:00
Jan Janssen 6a261332bc boot: Drop use of LibLocateProtocol 2022-06-09 12:50:13 +02:00
Jan Janssen f747ca3ec3 boot: Drop use of LibOpenRoot 2022-06-09 12:50:13 +02:00
Jan Janssen 7ebce8145e boot: Drop use of LibGetSystemConfigurationTable 2022-06-09 12:50:13 +02:00
Jan Janssen 23742af522 boot: Drop use of MetaiMatch
A future commit will add support for unicode collation protocol that
allows case folding and comparing strings with locale awareness. But it
only operates on whole strings, so fnmatch cannot use those without a
heavy cost. Instead we just case fold the patterns instead (the IDs we
try to match are already lower case).
2022-06-09 12:50:13 +02:00
Jan Janssen 0e8ecba96e boot: Add efi_fnmatch
Unlike MetaiMatch from the UEFI spec/EDK2 this implementation is
intended to be compatible with POSIX fnmatch.
2022-06-09 12:50:08 +02:00
Zbigniew Jędrzejewski-Szmek 2299b1cae3 Resolve conflicts between #23616 and the recent NFT additions 2022-06-09 10:06:30 +02:00
Yu Watanabe 377157e6bd
Merge pull request #23616 from keszybz/in-addr-to-string-formatting
Add macros that allocate a fixed buffer for in_addr_to_string(), in_addr_prefix+to_string()
2022-06-09 15:21:57 +09:00
Zbigniew Jędrzejewski-Szmek e0d537950b test-load-fragment: don't print NULLs 2022-06-09 07:53:06 +02:00
Zbigniew Jędrzejewski-Szmek 817d19402f test-bus-address: silence gcc warning about NULL arg to strcmp()
The code was overly complicated… We know what value we expect, we can test it
directly.
2022-06-09 07:53:06 +02:00
Zbigniew Jędrzejewski-Szmek 1b3502b072 test-mountpoint-util: fix NULL arg to %s 2022-06-09 07:53:06 +02:00
Zbigniew Jędrzejewski-Szmek abcdc02cd0 sd-journal: inline variable declarations 2022-06-09 07:53:06 +02:00
Zbigniew Jędrzejewski-Szmek 70f50a4731 sd-journal: use _cleanup_ 2022-06-09 07:53:06 +02:00
Daan De Meyer a22f518676 meson: Add nspawn-locale meson option
https://github.com/systemd/systemd/pull/23192 caused breakage in
Arch Linux's build tooling. Let's give users an opt-out aside from
reverting the patch. It's hardly any maintenance work on our side
and gives users an easy way to revert the locale change if needed.

Of course, by default we still pick C.UTF-8 if the option is not
specified.
2022-06-09 13:08:27 +09:00
Nick Rosbrook c76b8751b3 nspawn: use udev_available() 2022-06-08 18:32:37 -04:00
Nick Rosbrook bfe2e67f25 libsystemd-network: use udev_available() 2022-06-08 18:32:37 -04:00
Topi Miettinen 46c3b1ff88 core: firewall integration with DynamicUserNFTSet=
New directive `DynamicUserNFTSet=` provides a method for integrating
configuration of dynamic users into firewall rules with NFT sets.

Example:
```
table inet filter {
        set u {
                typeof meta skuid
        }

        chain service_output {
                meta skuid != @u drop
                accept
        }
}
```

```
/etc/systemd/system/dunft.service
[Service]
DynamicUser=yes
DynamicUserNFTSet=inet:filter:u
ExecStart=/bin/sleep 1000

[Install]
WantedBy=multi-user.target
```

```
$ sudo nft list set inet filter u
table inet filter {
        set u {
                typeof meta skuid
                elements = { 64864 }
        }
}
$ ps -n --format user,group,pid,command -p `pgrep sleep`
    USER    GROUP     PID COMMAND
   64864    64864   55158 /bin/sleep 1000
```
2022-06-08 16:12:25 +00:00
Topi Miettinen c0548df0a2 core: firewall integration with ControlGroupNFTSet=
New directive `ControlGroupNFTSet=` provides a method for integrating services
into firewall rules with NFT sets.

Example:

```
table inet filter {
...
        set timesyncd {
                type cgroupsv2
        }

        chain ntp_output {
                socket cgroupv2 != @timesyncd counter drop
                accept
        }
...
}
```

/etc/systemd/system/systemd-timesyncd.service.d/override.conf
```
[Service]
ControlGroupNFTSet=inet:filter:timesyncd
```

```
$ sudo nft list set inet filter timesyncd
table inet filter {
        set timesyncd {
                type cgroupsv2
                elements = { "system.slice/systemd-timesyncd.service" }
        }
}
```
2022-06-08 16:12:25 +00:00
Topi Miettinen ab51fd9dbd network: firewall integration with NFT sets
New directives `NFTSet=`, `IPv4NFTSet=` and `IPv6NFTSet=` provide a method for
integrating configuration of dynamic networks into firewall rules with NFT
sets.

/etc/systemd/network/eth.network
```
[DHCPv4]
...
NFTSet=netdev:filter:eth_ipv4_address
```

```
table netdev filter {
        set eth_ipv4_address {
                type ipv4_addr
                flags interval
        }
        chain eth_ingress {
                type filter hook ingress device "eth0" priority filter; policy drop;
                ip saddr != @eth_ipv4_address drop
                accept
        }
}
```
```
sudo nft list set netdev filter eth_ipv4_address
table netdev filter {
        set eth_ipv4_address {
                type ipv4_addr
                flags interval
                elements = { 10.0.0.0/24 }
        }
}
```
2022-06-08 16:12:25 +00:00
Luca Boccassi e8f1b50f27
Merge pull request #23641 from keszybz/janitorials
Janitorial cleanups
2022-06-08 17:08:13 +01:00
Daan De Meyer 647475c7df basic: Propagate SIGBUS signal info when re-raising signals
raise() won't propagate the siginfo information of the signal that's
re-raised. rt_sigqueueinfo() allows us to provide the original siginfo
struct which makes sure it is propagated to the next signal handler
(or to the coredump).
2022-06-07 19:10:34 +01:00
Zbigniew Jędrzejewski-Szmek 0d7e34e3e6 basic/socket-util: align tables 2022-06-07 15:18:46 +02:00
Zbigniew Jędrzejewski-Szmek 76973becae activate: reduce scope of iterator variables 2022-06-07 15:18:46 +02:00
Zbigniew Jędrzejewski-Szmek 09f4d843ee core: wrap some long comments 2022-06-07 15:18:46 +02:00
Zbigniew Jędrzejewski-Szmek 066a6f0768 shared/condition: reduce scope of variables 2022-06-07 15:18:38 +02:00
Zbigniew Jędrzejewski-Szmek da60e5b5c7 bootctl: inline iterator variable 2022-06-07 15:17:06 +02:00
Daan De Meyer db6f9b02a7
Merge pull request #23645 from DaanDeMeyer/journalctl-static-destructor
journalctl: Use STATIC_DESTRUCTOR_REGISTER()
2022-06-07 12:28:37 +01:00
Zbigniew Jędrzejewski-Szmek 85b0ff8abf sd-journal: fix NULL arg to %s in error messages and hashmap lookup
The lookup "works", but is not useful. It was introduced in
9c66f52813.

And printf will NULL args is invalid was introduced in
5d1ce25728 when support for fds was initally
added :(
2022-06-07 11:22:15 +02:00
Zbigniew Jędrzejewski-Szmek 9908091b96 sd-hwdb: fix NULL arg to %s in error messages
gcc warns about $subject, and it is obviously correct. path may or
may not be set.
2022-06-07 11:22:15 +02:00
Zbigniew Jędrzejewski-Szmek 6c279977e3 basic/unit-file: make sure we don't call streq() on NULL
add_names is called in two places, with fragment_basename=NULL in one of them.
gcc warns that it can be NULL.

Fixes #23646.
2022-06-07 11:22:08 +02:00
Michael Biebl 5fb225615b meson: install libsystemd-shared into rootpkglibdir
Introduce rootpkglibdir for installing libsystemd-{shared,core}.so.
The benefit over using rootlibexecdir is that this path can be
multiarch aware, i.e. this path can be architecture qualified.

This is something we'd like to make use of in Debian/Ubuntu to make
libsystemd-shared co-installable, e.g. for i386 the path would be
/usr/lib/i386-linux-gnu/systemd/libsystemd-shared-*.so and for amd64
/usr/lib/x86_64-linux-gnu/systemd/libsystemd-shared-*.so.
This will allow for example to install and run systemd-boot/i386 on an
amd64 host. It also simplifies/enables cross-building/bootstrapping.

For more infos about Multi-Arch see https://wiki.debian.org/Multiarch.

See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990547
2022-06-07 10:04:43 +02:00
Topi Miettinen 3cf63830ac networkd: NetLabel integration
New directive `NetLabel=` provides a method for integrating dynamic network
configuration into Linux NetLabel subsystem rules, used by Linux security
modules (LSMs) for network access control. The option expects a whitespace
separated list of NetLabel labels. The labels must conform to lexical
restrictions of LSM labels. When an interface is configured with IP addresses,
the addresses and subnetwork masks will be appended to the NetLabel Fallback
Peer Labeling rules. They will be removed when the interface is
deconfigured. Failures to manage the labels will be ignored.

Example:
```
[DHCP]
NetLabel=system_u:object_r:localnet_peer_t:s0
```

With the above rules for interface `eth0`, when the interface is configured with
an IPv4 address of 10.0.0.0/8, `systemd-networkd` performs the equivalent of
`netlabelctl` operation

```
$ sudo netlabelctl unlbl add interface eth0 address:10.0.0.0/8 label:system_u:object_r:localnet_peer_t:s0
```

Result:
```
$ sudo netlabelctl -p unlbl list
...
 interface: eth0
   address: 10.0.0.0/8
    label: "system_u:object_r:localnet_peer_t:s0"
...
```
2022-06-06 18:24:10 +00:00
Shreenidhi Shedi 41abd7f6df execute: fix resource leak
CID#1431998
2022-06-06 16:34:37 +02:00
Daan De Meyer 2e64b27aeb journalctl: Use STATIC_DESTRUCTOR_REGISTER() 2022-06-06 16:04:53 +02:00
Daan De Meyer e30c1d01b6 shared: Rename pcre2-dlopen.h/c to pcre2-util.h/c
We already store the dlopen() stuff for other libraries in util headers
as well so let's do the same for pcre2. We also move the definition of
some trivial cleanup functions from journalctl.c to pcre2-util.h
2022-06-06 16:01:20 +02:00
Zbigniew Jędrzejewski-Szmek 369151c9c7
Merge pull request #23621 from evverx/clang-release
ci: build systemd with clang with -Dmode=release --optimization=2
2022-06-06 12:17:48 +02:00
Zbigniew Jędrzejewski-Szmek 89eb3d7c95 various: use CONST_MAX for array allocation
IIUC, with MAX() we get a VLA and the size is "decided" at runtime,
even though the result is always the same, but with CONST_MAX() we
get a normal stack variable.
2022-06-06 09:52:52 +02:00
Zbigniew Jędrzejewski-Szmek 071e522eec tree-wide: convert inet_ntop() calls to anonymous-buffer macros 2022-06-06 09:52:52 +02:00
Zbigniew Jędrzejewski-Szmek c71384a9ee basic/in-addr-util: add IN_ADDR_PREFIX_TO_STRING 2022-06-06 09:52:52 +02:00
Zbigniew Jędrzejewski-Szmek 61af181344 basic/in-addr-util: drop check for prefix length in formatting function
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-06 09:52:52 +02:00
Zbigniew Jędrzejewski-Szmek dd6d433a4f libsystemd-network: minor simplification 2022-06-06 09:52:52 +02:00
Zbigniew Jędrzejewski-Szmek f69ea167eb resolved: use TAKE_PTR() in one more place 2022-06-06 09:52:52 +02:00
Zbigniew Jędrzejewski-Szmek 94a779628a networkctl: assume that we can always print local networking addresses
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-06 09:52:52 +02:00
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
Evgeny Vereshchagin 2cfb790391 Revert "Support -D_FORTIFY_SOURCE=3 by using __builtin_dynamic_object_size."
This reverts commit 0bd292567a.

It isn't guaranteed anywhere that __builtin_dynamic_object_size can
always deduce the size of every object passed to it so systemd
can end up using either malloc_usable_size or
__builtin_dynamic_object_size when pointers are passed around,
which in turn can lead to actual segfaults like the one mentioned in
https://github.com/systemd/systemd/issues/23619.

Apparently __builtin_object_size can return different results for
pointers referring to the same memory as well but somehow it hasn't
caused any issues yet. Looks like this whole
malloc_usable_size/FORTIFY_SOURCE stuff should be revisited.

Closes https://github.com/systemd/systemd/issues/23619 and
https://github.com/systemd/systemd/issues/23150.

Reopens https://github.com/systemd/systemd/issues/22801
2022-06-05 19:13:17 +00:00
Shreenidhi Shedi 5c95eb2888 manager: ignore return value of unit_watch_pid()
Also, explicitly ignore return value of service_set_main_pid() calls in
few places.

Fixes: CID#1474975
2022-06-05 22:58:01 +05:30
Shreenidhi Shedi 8d862fd39d machinectl: ignore return value of get_process_comm()
Fixes: CID#1469720
2022-06-05 22:58:01 +05:30
Shreenidhi Shedi a30c9e7176 polkit: explicitly ignore fd_wait_for_event()'s return value
Fixes: CID#1469718
2022-06-05 22:58:01 +05:30
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
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
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
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
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
Zbigniew Jędrzejewski-Szmek 44005a5778 shared/bpf: install log callback and suppress most messages from libbpf
$ 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-02 10:48:31 +02:00
Zbigniew Jędrzejewski-Szmek 386b8026e5 meson: use files() for libcore_sources too
C.f. f1b98127ff.
2022-06-02 07:53:14 +02:00
Zbigniew Jędrzejewski-Szmek c6cb9d9074 userwork: use a better errno value
ESRCH is literally "No such process".
2022-06-02 07:53:14 +02:00
Zbigniew Jędrzejewski-Szmek 2e09b2235a various: add %m in messages
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-02 07:53:14 +02:00
Yu Watanabe 93d13a7dff test: fix indentation 2022-06-02 14:14:22 +09:00
Yu Watanabe 3bccc736c6 test: add test for sha256 2022-06-02 14:14:22 +09:00
Yu Watanabe c7a5eabeba sha256: use memcpy() when result buffer is unaligned
Fixes #23578.
2022-06-02 14:14:22 +09:00
Zbigniew Jędrzejewski-Szmek af72f975fe Move basic/recovery-key.* to shared/
No particular reason to have it in basic/. We should let homectl
and other users share the single copy through libsystemd-shared.
2022-06-02 13:09:09 +09:00
Zbigniew Jędrzejewski-Szmek 14c811ff4a
Merge pull request #23575 from keszybz/logind-wall-message-cleanup
Cleanup wall messages emitted by logind and systemctl
2022-06-01 16:26:29 +02:00
Zbigniew Jędrzejewski-Szmek d5254fa2f6
Merge pull request #23574 from keszybz/logind-pty-wall
Do not print logind wall message to local terminals
2022-06-01 16:26:03 +02:00
Benjamin Franzke de777ffae8 resolved: choose correct file descriptor for proxy stub replies
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-01 15:08:33 +02:00
Li kunyu b278cf2efd src: The return value of server_vacuum () is not used and could be modified to void type 2022-06-01 09:32:22 +02:00
Christian Göttsche ea74f39c24 login: do not issue wall messages on local terminals for suspend and hibernate
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-01 09:30:07 +02:00
Zbigniew Jędrzejewski-Szmek b622d2f789 shared/pager: print the name of the pager we'll try next in debug message
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-01 09:27:35 +02:00
Zbigniew Jędrzejewski-Szmek 5b69a7c540 man/systemctl: improve grammar in description of --check-inhibitors 2022-06-01 09:23:55 +02:00
Zbigniew Jędrzejewski-Szmek 1cc11a0951 systemctl: drop translation of method names to descriptions in error message
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-01 09:23:55 +02:00
Zbigniew Jędrzejewski-Szmek 346840b159 systemctl: make function static 2022-06-01 09:23:55 +02:00
Zbigniew Jędrzejewski-Szmek b280061314 logind: reduce scope of a few variables 2022-06-01 09:23:55 +02:00
Zbigniew Jędrzejewski-Szmek 3dbb9bc5eb logind: rework wall message about pending shutdown/halt/reboot/…
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-06-01 09:23:05 +02:00
Yu Watanabe 9db25d01ef
Merge pull request #23531 from yuwata/sd-bus-drop-version-2
sd-bus: drop version 2 format support
2022-06-01 14:51:44 +09:00
Yu Watanabe cd25e17001
Merge pull request #23512 from medhefgo/efi-clang
boot: Add string functions
2022-06-01 06:16:48 +09:00
Benjamin Franzke dfa14e2859 resolved: define source address for proxy-only stub replies
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
a8d0906344 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-31 22:38:47 +02:00
Zbigniew Jędrzejewski-Szmek 51a2b575d7 logind: do not print wall messages to local pseudoterminals
Fixes #23520. Replaces #23555.

The problem started with cdf370626f and
90b1ec03b2 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-31 22:30:08 +02:00
Zbigniew Jędrzejewski-Szmek e31355bbc1 tests: add a helper that dumps /run/utmp in detail
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-31 22:30:08 +02:00
Yu Watanabe 98406eda8a network/erspan: support erspan version 0 and 2
This also makes networkd accepts erspan index 0.

Closes #23570.
2022-06-01 04:02:48 +09:00
Yu Watanabe a452cfd77b sd-bus: drop constant argument for message_extend_fields() 2022-06-01 03:41:16 +09:00
Yu Watanabe 0dd4876815 sd-bus: drop D-Bus version 2 format support
It seems the format is used only by kdbus.
2022-06-01 03:41:15 +09:00
Yu Watanabe c0f664ca89 sd-bus: merge message_peek_fields() and buffer_peek() 2022-06-01 03:41:15 +09:00
Yu Watanabe 75c85c3b25 sd-bus: make several functions static
And drop 'bus_' prefix from them.
2022-06-01 03:41:15 +09:00
Yu Watanabe 590a738562 sd-bus: use UINT32_MAX 2022-06-01 03:41:15 +09:00
Yu Watanabe b7096bd690 sd-bus: drop unnecessary cast 2022-06-01 03:41:15 +09:00
Yu Watanabe 30da99bd30 sd-bus: drop redundant condition
By the previous commit, ALIGN8() is always equal to or greater than the
argument.
2022-06-01 03:41:15 +09:00
Yu Watanabe dc7be33266 sd-bus: use ALIGN8() 2022-06-01 03:41:15 +09:00
Yu Watanabe b4e7df4a47 boot: use ALIGN4() 2022-06-01 03:41:15 +09:00
Yu Watanabe 4c8d7caf1a macro: make ALIGN4() and ALIGN8() also return SIZE_MAX on overflow
This also drops unused ALIGN4_PTR(), ALIGN8_PTR(), and ALIGN_TO_PTR().
2022-06-01 03:40:20 +09:00
Yu Watanabe 394129f88b tree-wide: use ALIGN_PTR() 2022-06-01 03:12:33 +09:00
Yu Watanabe a0f0cf0a6b portable: fix command option in comment
Follow-up for edea370222.
2022-05-31 16:32:09 +02:00
Zbigniew Jędrzejewski-Szmek 978af07f66 logind: use consistent casing in message
The other strings use "sentence capitalization". Let's do the
same here.
2022-05-31 15:59:40 +02:00
Zbigniew Jędrzejewski-Szmek 3c98bdce55 logind: align tables 2022-05-31 15:59:29 +02:00
Zbigniew Jędrzejewski-Szmek 1661833238 shared/utmp-wtmp: pass information if entry is local to filter function
This just adds an unused parameter for future use. No change in
behaviour.
2022-05-31 15:54:16 +02:00
Zbigniew Jędrzejewski-Szmek b5cb2d2847 tty-ask-password-agent: drop unnecessary code for non-absolute paths
utmp_wall() always prepends /dev/, so we don't need to do this a second
time here.
2022-05-31 15:54:03 +02:00