Commit Graph
34349 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 111a3aae71 partition, random-seed, logind: fix log messages with %m
We would print "...: Success", which is not too terrible, but not pretty
either.
2021-04-14 16:19:54 +02:00
Zbigniew Jędrzejewski-Szmek aca591ac55 sd-device: improve log message and tweak style
We shouldn't say the attribute is missing right after ruling out ENOENT.
2021-04-14 16:19:54 +02:00
Zbigniew Jędrzejewski-Szmek 2d359acda5 libsystemd-network: fix dhcp option buffer confusion
We were writing to the wrong buffer with a wrong offset :(
Bug present since the original introduction of the code in
04b28be1a3.
2021-04-14 16:19:54 +02:00
Zbigniew Jędrzejewski-Szmek 47350c5fb6 meson: simplify the BUILD_MODE conditional
Using a enum is all nice and generic, but at this point it seems unlikely that
we'll add further build modes. But having an enum means that we need to include
the header file with the enumeration whenerever the conditional is used. I want
to use the conditional in log.h, which makes it hard to avoid circular imports.
2021-04-14 16:19:54 +02:00
Zbigniew Jędrzejewski-Szmek 5600a26114 bpf-devices: update comment 2021-04-14 15:29:41 +02:00
Yu Watanabe f11bee0cb9 wait-online: update debug log messages 2021-04-14 22:17:44 +09:00
Yu Watanabe 90afec1834 network: shorten code a bit 2021-04-14 22:13:46 +09:00
Luca Boccassi c2b2df604b tree-wide: avoid uninitialized warning on _cleanup_ variables
With some versions of the compiler, the _cleanup_ attr makes it think
the variable might be freed/closed when uninitialized, even though it
cannot happen. The added cost is small enough to be worth the benefit,
and optimized builds will help reduce it even further.
2021-04-14 12:25:06 +01:00
Yu Watanabe c68ede3952 util: shorten allow_listed_char_for_devnode() 2021-04-14 11:04:46 +01:00
Yu Watanabe a2b1572ce4 Merge pull request #19287 from yuwata/network-manage-foreign-routing-policy-rule-19106
network: add ManageForeignRoutingPolicyRules= boolean setting
2021-04-14 19:01:41 +09:00
Luca Boccassi ab1aa6368a rfkill: add some casts to silence -Werror=sign-compare 2021-04-14 10:26:31 +01:00
Yu Watanabe f90635f14f network: dhcp4: warn when Anonymize=yes and ClientIdentifier= is not mac 2021-04-14 14:15:11 +09:00
Yu Watanabe 0078195835 network: drop unnecessary explicit initializations 2021-04-14 13:06:54 +09:00
Yu Watanabe a83bda058c network: dhcp4: do not request any additional options when Anonymize=yes
This makes networkd can use recieved options we do not request.
2021-04-14 13:06:54 +09:00
Yu Watanabe ae7ea5a7ba network: move and rename network_apply_anonymize_if_set() 2021-04-14 13:06:50 +09:00
LetzteInstanz 6dc4531d16 wait-online: wait for address family
This introduce -4 and -6 commandline options.
2021-04-14 09:00:08 +09:00
LetzteInstanz bbea881312 sd-network: read IPv4/IPv6 address states from state files 2021-04-14 08:51:08 +09:00
LetzteInstanz 8430841b5e network: save IPv4/IPv6 address states into state file
This also introduces RequiredFamilyForOnline= setting to .network file,
and IPv4AddressState/IPv6AddressState DBus properties.
2021-04-14 08:51:02 +09:00
LetzteInstanz 86ae2d69a3 network: move AddressFamily into network-util for the use by wait-online later 2021-04-14 08:30:18 +09:00
gaoyi 993eb00016 udev: delete useless codes
It seems no one will touch queue.bin
2021-04-14 08:07:40 +09:00
Yegor Alexeyev 21b6b87eb3 dhcp: Implemented BindToInterface= configuration option 2021-04-14 07:30:40 +09:00
Yu Watanabe 57442d2dfe network: fix indentation 2021-04-13 14:50:44 +09:00
Yu Watanabe dfc58b4740 network: lldp: update mac address 2021-04-13 14:45:54 +09:00
Yu Watanabe bc9e40c9a1 network: refuse to configure engines such as DHCP client more than once 2021-04-13 14:38:24 +09:00
Yu Watanabe 050f05c2eb tree-wide: update comment about unnecessary initialization 2021-04-13 12:53:32 +09:00
Yu Watanabe d94dfe7053 network: introduce ManageForeignRoutingPolicyRules= boolean setting in networkd.conf
The commit 0b81225e57 makes that networkd
remove all foreign rules except those with "proto kernel".

But, in some situation, people may want to manage routing policy rules
with other tools, e.g. 'ip' command. To support such the situation,
this introduce ManageForeignRoutingPolicyRules= boolean setting.

Closes #19106.
2021-04-13 12:22:42 +09:00
Yu Watanabe 6bfadad9bb network: add missing default setting in networkd.conf 2021-04-13 12:07:09 +09:00
Francois Gervais 54cfe9a75f load-fragment: parse specifiers in CPUAffinity= (#19281) 2021-04-13 07:25:29 +09:00
Lennart Poettering 59b8635a33 Merge pull request #18701 from bugaevc/mdns-unicast
resolved: reply using unicast mDNS when appropriate
2021-04-12 17:53:38 +02:00
Zbigniew Jędrzejewski-Szmek 839eb4a458 Merge pull request #13496 from wat-ze-hex/custom-bpf-progs-parameterized-3
bpf: extend bpf cgroup program support
2021-04-12 14:31:42 +02:00
Yu Watanabe 9bafb8d504 sd-dhcp-client: constify argument in sd_dhcp_lease_get_xxx() 2021-04-12 09:55:26 +02:00
Yu Watanabe 37da8bca92 networkctl: drop unused variables 2021-04-12 09:09:57 +02:00
Luca Boccassi 0efcbecd8b test-repart: use cryptsetup and losetup autoclose
The test occasionally fails as the umount is not yet completed when
cryptsetup close is invoked.
Both cryptsetup and losetup have supported deferred cleanup for some
time now, so use it instead to avoid races.

++ losetup -P --show --find /tmp/test-repart.dMOfYQ8UUF/zzz
+ LOOP=/dev/loop6
+ VOLUME=test-repart-11882
+ touch /tmp/test-repart.dMOfYQ8UUF/empty-password
+ cryptsetup open --type=luks2 --key-file=/tmp/test-repart.dMOfYQ8UUF/empty*** test-repart-11882
+ mkdir /tmp/test-repart.dMOfYQ8UUF/mount
+ mount -t ext4 /dev/mapper/test-repart-11882 /tmp/test-repart.dMOfYQ8UUF/mount
+ diff -r /tmp/test-repart.dMOfYQ8UUF/mount/def /tmp/test-repart.dMOfYQ8UUF/definitions
+ umount /tmp/test-repart.dMOfYQ8UUF/mount
+ cryptsetup close test-repart-11882
Device test-repart-11882 is still in use.
+ rm -rf /tmp/test-repart.dMOfYQ8UUF
2021-04-11 23:50:31 +09:00
Luca Boccassi 3f66ded568 scsi_id: use read_line instead of fgets
LGTM warns about it:

"Call to fgets() is potentially dangerous. Use read_line() instead."
2021-04-11 15:45:06 +01:00
Yu Watanabe 37b7a716d3 Merge pull request #19164 from mmatsuya/main
tmpfiles: use a entry in hashmap as ItemArray in read_config_file()
2021-04-11 16:46:25 +09:00
Oleg Popov b204bdd4cc Extend characters set for PKCS11 URI
There are tokens with dots (and other symbols) in PKCS11 URI:

pkcs11:model=Rutoken%20ECP;manufacturer=Aktiv%20Co.;serial=3xxxxxxb;token=livelace
pkcs11:model=PRO;manufacturer=Aladdin%20R.D.;serial=CC62FB25;token=val%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00;id=%33%32%31%30%33%61%36%37%36%65%32%34%35%62%32%31;type=private
2021-04-10 20:24:18 +01:00
Yu Watanabe 5c078687dc network: refuse to configure NDISC twice 2021-04-10 20:16:11 +01:00
Lennart Poettering 1065501406 resolved: add RFC 8375 "home.arpa" to list of default NTA
RFC 8375 introduced "home.arpa" as special TLD for home networks. Let's
hence add it to our default list of NTAs.
2021-04-10 20:14:57 +01:00
Lennart Poettering a8fd92b5a3 openssl: make RSA struct const
OpenSSL 3.0 broke API there, but it doesn't hurt to add the "const",
hence add it.

Fixes: #19267
2021-04-10 20:03:06 +01:00
Yu Watanabe 080e5c2fde sd-dhcp6-client: do not use IN_SET() macro when only one target value 2021-04-10 13:24:56 +01:00
Yu Watanabe 942cf4b8d1 network: adjust log message 2021-04-10 13:24:06 +01:00
Yu Watanabe a78f938aaf network: drop unnecessary bitfield specifier
Manager is allocated only once. It is not necessary to optimize its
size.
2021-04-10 13:23:38 +01:00
Julia Kartseva 9e009a145d dbus-cgroup: add BPFProgram= dbus support
- Handle BPFProgram= property in string format
"<bpf_attach_type>:<bpffs_path>", e.g. egress:/sys/fs/bpf/egress-hook.
- Add dbus getter to list foreign bpf programs attached to a cgroup.
2021-04-09 20:28:47 -07:00
Julia Kartseva b57162aafb tests: add unit file tests for BPFProgram=
- Pin trivial bpf programs to bpf filesystem, compose BPFProgram= option
string and pass it to a unit. Programs store `0` in r0 BPF register for
denying action, e.g. drop a packet.
- Load trivial BPF programs
- Test is skipped if not run under root or if can not lock enough
memory.
- For egress and ingress hooks, test BPFProgram= option along with
with IP{Egress|Ingress}FilterPath=, expected result should not depend on
which rule is executed first.
Expected results for BPF_CGROUP_INET_INGRESS:
5 packets transmitted, 0 received, 100% packet loss, time 89ms

For BPF_CGROUP_INET_SOCK_CREATE:
ping: socket: Operation not permitted
2021-04-09 20:28:47 -07:00
Julia Kartseva 0879da98dc core: add bpf-foreign to fragment parser
- Parse a string for bpf attach type
- Simplify bpffs path
- Add foreign bpf program to cgroup context
2021-04-09 20:28:47 -07:00
Julia Kartseva 506ea51b48 core: add bpf-foreign cgroup mask and harness
Add CGROUP_MASK_BPF_FOREIGN to CGROUP_MASK_BPF and standard cgroup
context harness.
2021-04-09 20:28:47 -07:00
Julia Kartseva 5f8ba20d7f core: add bpf-foreign unit helpers
- Introduce support of cgroup-bpf programs managed (i.e. compiled,
loaded to and unloaded from kernel) externally. Systemd is only
responsible for attaching programs to unit cgroup hence the name
'foreign'.

Foreign BPF programs are identified by bpf program ID and attach type.

systemd:
- Gets kernel FD of BPF program;
- Makes a unique identifier of BPF program from BPF attach type and
program ID. Same program IDs mean the same program, i.e the same
chunk of kernel memory. Even if the same program is passed multiple
times, identical (program_id, attach_type) instances are collapsed
into one;
- Attaches programs to unit cgroup.
2021-04-09 20:28:47 -07:00
Julia Kartseva b894ef1b71 cgroup: add foreign program to cgroup context
- Store foreign bpf programs in cgroup context. A program is considered
foreign if it was loaded to a kernel by an entity external to systemd,
so systemd is responsible only for attach and detach paths.
- Support the case of pinned bpf programs: pinning to bpffs so a program
is kept loaded to the kernel even when program fd is closed by a user
application is a common way to extend program's lifetime.
- Aadd linked list node struct with attach type and bpffs path
fields.
2021-04-09 20:28:47 -07:00
Julia Kartseva 9984f4933b shared: bpf_attach_type {from,to} string
Introduce bpf_cgroup_attach_type_table with accustomed attached type
names also used in bpftool.
Add bpf_cgroup_attach_type_{from|to}_string helpers to convert from|to
string representation of pinned bpf program, e.g.
"egress:/sys/fs/bpf/egress-hook" for
/sys/fs/bpf/egress-hook path and BPF_CGROUP_INET_EGRESS attach type.
2021-04-09 20:28:47 -07:00
Julia Kartseva f23f0ead1f shared: add bpf-program helpers
Add helpers to:
- Create new BPFProgram instance from a path in bpf
filesystem and bpf attach type;
- Pin a program to bpf fs;
- Get BPF program ID by BPF program FD.
2021-04-09 20:28:47 -07:00