Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe d5bfddf037 man: fix typo
Follow-up for e73309c532.
2021-04-20 11:41:05 +01:00
Yu Watanabe 66205cb3f5 wifi-util: do not set zero errno to log_debug_errno() 2021-04-20 10:39:50 +02:00
Yu Watanabe 4e6c50a5d4 core: add RestrictAddressFamilies=none to deny all address families
Closes #15753.
2021-04-19 11:47:08 +01:00
Yu Watanabe 6604fb0207 fileio: use take_fdopen_unlocked()
This fixes maybe-uninitialized warning:
```
../src/basic/fileio.c: In function ‘chase_symlinks_and_fopen_unlocked’:
../src/basic/fileio.c:1026:19: warning: ‘f’ may be used uninitialized in this function [-Wmaybe-uninitialized]
 1026 |         *ret_file = f;
      |         ~~~~~~~~~~^~~

```
2021-04-17 00:22:12 +09:00
Yu Watanabe b4bc798f87 Merge pull request #19332 from yuwata/log_xxx_yyy_errno-follow-ups-19317
core,timedate,network: make log_unit_error_errno() or friends refuse zero errno
2021-04-16 23:44:32 +09:00
Yu Watanabe 4ab334472c Merge pull request #19325 from sainAk/patch-1
hwdb: 60-keyboard:: merge Micro Star in MSI and  merge MSI Prestige And MSI Modern FnKeys and Special keys definitions
2021-04-16 20:01:10 +09:00
Yu Watanabe 74bd6ad016 network: update log message
In some optimization level with gcc, including netdev->ifname in log
message causes error.
2021-04-16 19:48:54 +09:00
Yu Watanabe 6064344894 network: make log_netdev_xxx_errno() refuse zero errno 2021-04-16 09:17:28 +09:00
Yu Watanabe 5b098203fd timedate: make log_unit_xxx_errno() refuse zero errno 2021-04-16 08:46:51 +09:00
Yu Watanabe ac51363496 core: make log_unit_xxx_errno() refuse zero errno 2021-04-16 08:46:11 +09:00
Yu Watanabe 22bbba8444 sd-dhcp-client: introduce sd_dhcp_client_is_running() 2021-04-14 22:31:28 +02:00
Yu Watanabe 6fb61918cc udev: ignore additional newline in sysfs attribute on verify
Some driver may automatically add additional newline at the end.
E.g., portno attribute for qeth driver.

Fixes #19314.
2021-04-15 01:46:58 +09:00
Yu Watanabe 6873d20392 fileio: introduce a new flag to make write_string_file() ignore trailing newline
When writing a sysfs attribute, kernel may automatically append newline
at the end, e.g., 'portno' attribute for qeth driver.
2021-04-15 01:40:52 +09: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
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
Yu Watanabe c7cbe25d11 Merge pull request #19069 from LetzteInstanz/waiting_for_address_family
systemd-networkd-wait-online: wait for specific address family
2021-04-14 18:57:39 +09:00
Yu Watanabe 86d58c8625 man: update explanation for Anonymize= 2021-04-14 14:15:15 +09: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
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 f1a5c566c1 man: fix typo 2021-04-13 12:52:56 +09:00
Yu Watanabe 3fe23a96d6 man: update description for ManageForeignRoutes= 2021-04-13 12:23:59 +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
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
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
Yu Watanabe 5c078687dc network: refuse to configure NDISC twice 2021-04-10 20:16:11 +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
Yu Watanabe 8cd37e4354 network: do not require DHCPv6 addresses when UseAddress=no
Follow-up for 1536b7b2d0.

Fixes #19196.
2021-04-09 08:15:34 +02:00
Yu Watanabe a73f8e9f32 network: do not emit changed properties when bus connection is not ready
Prompted by #19212.
2021-04-08 14:48:46 +02:00
Yu Watanabe ecb4b08c2e test: move check of nat table existence
As test_v4() with iptables backend will be called after nftables tests.

Follow-up for afbcd90552.
2021-04-08 14:39:53 +02:00
Yu Watanabe cb8c948738 udev: use snprintf_ok() 2021-04-08 01:38:47 +09:00
Yu Watanabe 5a6e56ec17 udev: fix potential infinite loop 2021-04-08 01:38:47 +09:00
Yu Watanabe 19ed9a114c udev: make dev_pci_slot() return earlier when PCI bridge is found 2021-04-08 01:38:47 +09:00
Yu Watanabe c304cb0146 udev: use uint32_t for hotplug_slot
This also makes function id is parsed as uint64_t. Kernel internally
uses uint32_t for function id (see the definition of 'struct zpci_dev),
but it maybe extended in the future.
2021-04-08 01:38:43 +09:00
Yu Watanabe fa28023c0f udev: split out logic of parsing s390 PCI slots
This also adds several debugging logs.
2021-04-08 01:35:43 +09:00
Yu Watanabe 70c35e4bfd udev: it is not necessary that the path is readable 2021-04-08 01:35:43 +09:00
Yu Watanabe b08c3fbe0e udev: add missing initialization to fix freeing invalid address 2021-04-08 01:35:43 +09:00
Yu Watanabe 0a8f9bc6bb dissect-image: move parent device check into device_is_partition()
Checking parent for enumerated devices is mostly redundant. Just for
safety.
2021-04-02 15:10:09 +09:00
Yu Watanabe 11368b694e dissect-image: also check devtype in device_is_partition()
This should be mostly redundant. Just for safety.
2021-04-02 15:10:09 +09:00
Yu Watanabe 210e1cd6e6 dissect-image: filter out enumerated or triggered devices without "partition" sysattr
This also adds more filters for device enumerator and monitor.
These newly added filters should be mostly redundant. But this hides
spurious error in sd_device_get_sysattr_value(). See,
https://github.com/systemd/systemd/pull/18684#discussion_r579700977
2021-04-02 15:10:09 +09:00
Yu Watanabe def366933c test: add tests for filters of sd-device-monitor 2021-04-02 15:10:09 +09:00
Yu Watanabe b8a0edbb2a sd-device-monitor: introduce sd_device_monitor_filter_add_match_parent() 2021-04-02 15:10:09 +09:00
Yu Watanabe bcfe746ba7 sd-device-enumerator: also move match_parent() to device-util.[ch] 2021-04-02 15:10:09 +09:00
Yu Watanabe d9b030b673 sd-device-monitor: introduce sd_device_monitor_filter_add_match_sysattr() 2021-04-02 15:10:09 +09:00
Yu Watanabe ac790e8bfc sd-device-enumerator: move match_sysattr() to device-util.[ch]
It will be used by sd-device-monitor in later commits.
2021-04-02 15:10:07 +09:00
Yu Watanabe 112e6dd106 sd-device-monitor: split passes_filter() into two parts 2021-04-02 15:09:03 +09:00
Yu Watanabe b5d2f4e757 test-firewall-util: use assert_se() at most places
Otherwise, we cannot notice any failures...
2021-03-25 01:05:54 +09:00
Yu Watanabe 9fffe0a912 resolve: dns_answer_contains() does not return negative errno 2021-03-23 21:30:23 +09:00
Yu Watanabe 06939d3b0c resolve: use dns_answer_size() and dns_answer_isempty() 2021-03-23 21:30:23 +09:00
Yu Watanabe ae526a5ea5 resolve: rename function argument in prototype to match its declaration 2021-03-23 21:30:23 +09:00
Yu Watanabe 160f3145db resolve: drop doubled white space 2021-03-23 21:30:23 +09:00
Yu Watanabe 8e95506a22 resolve: drop meaningless bitfield specifier
This also rearrange the members to remove holes in the struct.
2021-03-23 21:30:23 +09:00
Yu Watanabe 0c4363a005 firewall-util: refuse IPv6 firewall rules when kernel does not support IPv6 2021-03-23 15:17:44 +09:00
Yu Watanabe 175bc86315 firewall-util: gracefully handle -EOVERFLOW returned from older kernel 2021-03-23 15:17:44 +09:00
Yu Watanabe 5ee7c719e1 firewall-util: do not use goto for retrying 2021-03-23 15:17:44 +09:00
Yu Watanabe 84af90ba5d firewall-util: add missing return value check 2021-03-23 15:17:44 +09:00
Yu Watanabe dfb433f2a7 firewall-util: probe firewall backend in fw_ctx_new()
FirewallContext is used by networkd and nspawn. Both allocates the
context when it is really necessary. Hence, it is not necessary to delay
probing backend.

Moreover, if iptables backend is not enabled on build, and nftables is
not supported by kernel, previously `fw_nftables_init()` is called
everytime when we try to configure masquerade or dnat. It causes
significant performance loss.

Fixes test-firewall-util issue in #19052.
2021-03-23 15:17:34 +09:00
Yu Watanabe 4fb8a48ff0 network: allocate FirewallContext lazily 2021-03-23 14:41:13 +09:00
Yu Watanabe da00b84087 firewall-util: logs which backend will be used
This also modernizes code a bit.
2021-03-23 14:40:50 +09:00
Yu Watanabe c23bb96b38 shell-completion: systemd-run: add missing options
Closes #19044.
2021-03-22 21:20:17 +01:00
Yu Watanabe dcb6061e1c meson: fix warning about comparison between different types
Follow-up for e39288193f.
2021-03-22 14:40:46 +01:00
Yu Watanabe fcc3c20ca3 meson: fix build error of test-dnssec-complex
Fixes #19065.
2021-03-21 13:18:44 +01:00
Yu Watanabe 5cdb3f70eb udev: do not try to assign invalid ifname
Fixes #19038.
2021-03-19 09:52:21 +00:00
Yu Watanabe fa92d38428 dhcp6: fix wrong length for IA_PD dhcp6 option
Fixes an issue introduced by 73b49d433c.

When PrefixDelegationHint= is not set, dhcp6_option_append_pd() sets
wrong length for IA_PD option, as `r` is `-EINVAL`.

Fixes #19021.
2021-03-16 21:29:49 +01:00
Yu Watanabe efd3be9de1 sd-event: re-check new epoll events when a child event is queued
Previously, when a process outputs something and exit just after
epoll_wait() but before process_child(), then the IO event is ignored
even if the IO event has higher priority. See #18190.

This can be solved by checking epoll event again after process_child().

However, there exists a possibility that another process outputs and
exits just after process_child() but before the second epoll_wait().
When the IO event has lower priority than the child event, still IO
event is processed.

So, this makes new epoll events and child events are checked in a loop
until no new event is detected. To prevent an infinite loop, the number
of maximum trial is set to 10.

Fixes #18190.
2021-03-16 13:35:20 +01:00
Yu Watanabe b63dae3168 man: DNS/NTP servers received from DHCP server are concatenated with the statically configured ones
Prompted by #9473.
2021-03-15 14:48:47 +00:00
Yu Watanabe 6e4571f0c2 network: use string_hash_ops_free 2021-03-14 00:39:10 +09:00
Yu Watanabe cf45350745 ordered-set: make ordered_set_put_strdup() allocate OrderedSet object
For consistency with set_put_strdup().
2021-03-14 00:39:05 +09:00
Yu Watanabe f225a338c3 network: also introduce UseDomains= for [DHCPv6] section
When we split [DHCP] section into [DHCPv4] and [DHCPv6], UseDomains=
setting was forgot to be introduced in [DHCPv6] section.
2021-03-14 00:28:19 +09:00
Yu Watanabe 5b7f0aaf69 network: use userdata instead data in conf parsers
These takes no offset, so should not change any behavior.
2021-03-14 00:24:48 +09:00
Yu Watanabe 925bd4c24e fstab-util: fix typo in comment 2021-03-13 12:26:10 +01:00
Yu Watanabe c99c197d07 Merge pull request #18979 from keszybz/man-page-links
Man page links
2021-03-12 19:45:17 +09:00
Yu Watanabe 84e998c112 sd-event: re-check new epoll events when a child event is queued
Previously, when a process outputs something and exit just after
epoll_wait() but before process_child(), then the IO event is ignored
even if the IO event has higher priority. See #18190.

This can be solved by checking epoll event again after process_child().

However, there exists a possibility that another process outputs and
exits just after process_child() but before the second epoll_wait().
When the IO event has lower priority than the child event, still IO
event is processed.

So, this makes new epoll events and child events are checked in a loop
until no new event is detected. To prevent an infinite loop, the number
of maximum trial is set to 10.

Fixes #18190.
2021-03-11 23:09:04 +09:00
Yu Watanabe 7fe11e84c2 test: add log messages 2021-03-11 23:09:04 +09:00
Yu Watanabe 2eaed57bd4 Merge pull request #18932 from poettering/filename-max
Drop use of FILENAME_MAX
2021-03-09 14:15:49 +09:00
Yu Watanabe 0538d2a811 core/execute: sort conditions to make them match documentation 2021-03-08 21:42:06 +09:00
Yu Watanabe 266d0bb9e0 man: update document about NoNewPrivileges=
Fixes #18914.
2021-03-08 21:42:06 +09:00
Yu Watanabe a62f651b32 test: add one more test for system call filter with errno 2021-03-08 21:28:42 +09:00
Yu Watanabe 68acc1afbe seccomp: do not ignore deny-listed syscalls with errno when list is allow-list
Previously, if the hashmap is allow-list and a new deny-listed syscall
is added, seccomp_parse_syscall_filter() simply drop the new syscall
from hashmap even if error number is specified.

This makes 'allow-list' hashmap store two types of entries:
- allow-listed syscalls, which are stored with negative value (-1).
- deny-listed syscalls, which are stored with specified errno.

Fixes #18916.
2021-03-08 21:28:42 +09:00
Yu Watanabe 9e29ee4072 seccomp: use FLAGS_SET() macro 2021-03-08 21:28:42 +09:00
Yu Watanabe 084a46d7c5 core,seccomp: refuse to specify errno for allow-listed syscalls 2021-03-08 21:28:38 +09:00
Yu Watanabe 696a13bab7 core: drop meaningless parse_syscall_and_errno() calls
parse_syscall_and_errno() does not check the validity of syscall name or
syscall group name, but it just split into syscall name and errno.
So, it is not necessary to call it for SystemCallLog=.
2021-03-08 21:26:13 +09:00
Yu Watanabe 1862b310c5 seccomp: fix comment and change variable name 2021-03-08 21:25:54 +09:00
Yu Watanabe 335171ca84 test: parse_syscall_and_errno() accepts zero errno 2021-03-08 21:22:24 +09:00
Yu Watanabe 17884f979a test: move test_parse_syscall_and_errno() to test-seccomp.c 2021-03-08 21:22:24 +09:00
Yu Watanabe f96f5d54b8 socket-util: initialize variable with cleanup attribute
Follow-up for 83e03c4fc2.

Fixes CID#1448460.
2021-03-07 10:32:36 +09:00
Yu Watanabe edf1b5ec92 Merge pull request #18892 from poettering/cname-tweaks
resolved: properly handle stub replies for chains of multiple CNAMEs
2021-03-07 03:03:27 +09:00
Yu Watanabe f91861e49f dissect: fix memleak
Fixes #18903.
2021-03-07 03:02:47 +09:00
Yu Watanabe 2541462f1b Merge pull request #18890 from keszybz/fuzz-bus-match
Add fuzzers for bus match parsing code
2021-03-06 20:35:38 +09:00