Commit Graph
100 Commits
Author SHA1 Message Date
Yu Watanabe f782eee68a journal,network,timesync: fix segfault on 32bit timeval/timespec systems
Fixes #20741.
2021-09-16 11:47:44 +02:00
Yu Watanabe 2d253d7206 Merge pull request #20721 from mrc0mmand/test-storage-lvm
test: udev/LVM storage tests
2021-09-16 12:39:24 +09:00
Yu Watanabe 73bf0f2ace Merge pull request #20738 from mrc0mmand/ci-llvm-13
ci: build with clang-13
2021-09-16 09:32:21 +09:00
Yu Watanabe a871f3bb54 test: drop unnecessary sleep and 'udevadm settle'
After the triggered events are processed, all symlinks which store
watch handles should be valid.
2021-09-16 06:55:11 +09:00
Yu Watanabe a9d8bebacd test: use --settle option for udevadm trigger 2021-09-16 06:55:11 +09:00
Yu Watanabe e70f57796d test: use --settle option for udevadm trigger
Then, we can drop the loops.
This also drops unnecessary `udevadm control --reload`.
2021-09-16 06:55:04 +09:00
Yu Watanabe 9228ecaf8c test: use /dev/null instead of the loop back network interface
It should faster to be processed. So, we can shorten the timeout.
Also, this makes the test use `udevadm trigger`.
2021-09-16 06:46:19 +09:00
Yu Watanabe 26146d82db test: use --settle option for udevadm trigger 2021-09-16 06:39:48 +09:00
Yu Watanabe 65bf08dd4a Merge pull request #20729 from yuwata/ethtool-features-set
ethtool-util: support more offloading feature settings
2021-09-15 20:28:24 +09:00
Yu Watanabe 2c577df6f7 Merge pull request #20728 from yuwata/network-introduce-source-and-state-neighbor-rule-and-nexthops
network: introduce NetworkConfigSource/State
2021-09-15 20:26:44 +09:00
Yu Watanabe 3c76b1a157 Merge pull request #20742 from pdmorrow/startup_cpus
add StartupAllowedCPUs= and StartupAllowedMemoryNodes= directives
2021-09-15 20:26:10 +09:00
Yu Watanabe 89fa013349 network: use NetworkConfigSource/State to manage nexthops
This also changes the logic when Id= is not specified.
Previously, kernel picks the lowest unused ID, but now networkd picks
the lowest unused ID.
2021-09-15 16:50:23 +09:00
Yu Watanabe eb72fa3ad2 network: use NetworkConfigSource/State to manage routing policy rules
This also changes the logic when Priority= is not specified.
Previously, we request without FRA_PRIORITY attribute and kernel picks
the highest unused priority for the rule.
This makes networkd picks the highest unused priority and always request
FRA_PRIORITY attribute.
2021-09-15 16:50:23 +09:00
Yu Watanabe 193c4af94b network: use NetworkConfigSource/State to manage neighbors 2021-09-15 16:50:23 +09:00
Yu Watanabe a093533c33 network: introduce NetworkConfigSource and NetworkConfigState
These will be used in later commits.
2021-09-15 16:50:23 +09:00
Yu Watanabe 77bf5c31de ethtool-util: add more network device features
Then, we can easily add new settings to configure features in .link
file.
2021-09-15 02:12:02 +09:00
Yu Watanabe 7a4f203547 ethtool-util: apply tx-checksum-* features at last
NET_DEV_FEAT_TX matches multiple features. In the next commit, all
features whose strings start with "tx-checksum-" will be added.
To make them take precedence over NET_DEV_FEAT_TX, it will be applied
only when each explicit feature is not applied.
2021-09-15 02:07:15 +09:00
Yu Watanabe 008d3a370c ethtool: do not set unavailable or never_changed bits 2021-09-15 01:56:19 +09:00
Yu Watanabe 4253dab576 ethtool-util: shorten code a bit
Also fixes a error code in debugging log.
2021-09-15 01:41:19 +09:00
Yu Watanabe 6d9a72f3b9 ethtool-util: use sizeof() 2021-09-15 01:32:35 +09:00
Yu Watanabe 9d01399d44 network: replace config_parse_address_filter() with config_parse_in_addr_prefixes() 2021-09-14 20:31:17 +09:00
Yu Watanabe 84ebe6f013 core: replace IPAddressAccessItem with struct in_addr_prefix
Previously, if a unit file which contains n IPAddressAllow/Deny= lines,
then the computational order of parsing the file was O(n^3), as
ip_address_access_reduce(), whose order is O(n^2), is called for each line.

By replacing in_addr_prefix related functions, now the computational
order is O(n log n).

Fixes #20680.
2021-09-14 20:30:09 +09:00
Yu Watanabe 60da07ecc7 core/cgroup: set bitfield to reduce struct size 2021-09-14 20:30:09 +09:00
Yu Watanabe 0856e78df0 test: add tests for in-addr-prefix-util.c 2021-09-14 20:30:09 +09:00
Yu Watanabe 0bc311bbe9 test: slightly modernize test-in-addr-util.c 2021-09-14 20:30:09 +09:00
Yu Watanabe bffaa49ec4 in-addr-prefix-util: introduce several utilities for address prefix 2021-09-14 20:30:09 +09:00
Yu Watanabe c4f06a75ea Merge pull request #20700 from yuwata/network-dhcp-cleanups
network: several DHCP related cleanups
2021-09-14 20:29:27 +09:00
Yu Watanabe e47bcb7d0b network: do not use RouteTable= in [DHCPv4] section for DHCPv6 routes
We forgot to add RouteTable= in [DHCPv6] section when we split [DHCP]
into two.
2021-09-14 17:51:19 +09:00
Yu Watanabe 967e6a6403 network: use ltype to distinguish DHCPv4 and DHCPv6 2021-09-14 15:21:10 +09:00
Yu Watanabe 471e332d50 network: dhcp4: use free_and_strdup_warn() 2021-09-14 15:21:10 +09:00
Yu Watanabe ec84bb2a2b network: dhcp4: log server address 2021-09-14 15:21:10 +09:00
Yu Watanabe 3596fb3600 network: dhcp4: return earlier on failure 2021-09-14 15:21:10 +09:00
Yu Watanabe 429dc05a72 network: move common route settings to {dhcp4,ndisc}_request_route() 2021-09-14 15:21:10 +09:00
Yu Watanabe 8be102f8b8 test-network: kernel treats the lowest IP address as unicast since 5.14
See kernel's 94c821c74bf5fe0c25e09df5334a16f98608db90.
2021-09-13 21:41:16 +02:00
Yu Watanabe 2d3af41f0e udev-watch: retry to save watch handle with random delay
Also, remove the watch handle if we cannot save it.
2021-09-13 18:53:00 +09:00
Yu Watanabe 20ec7d9ed5 sd-device: do not recreate the same symlinks which store watch handle 2021-09-13 11:54:56 +09:00
Yu Watanabe d7950621d2 Merge pull request #20715 from yuwata/udev-node-follow-ups
udev-node: several follow-ups
2021-09-13 11:51:55 +09:00
Yu Watanabe cc8d67af54 Merge pull request #20672 from mrc0mmand/more-storage-tests
test: more storage-related tests
2021-09-13 11:50:51 +09:00
Yu Watanabe 0706cdf4ec udev-node: do not ignore unexpected errors on removing symlink in stack directory
Only acceptable error here is -ENOENT.
2021-09-12 16:14:44 +09:00
Yu Watanabe 3df566a667 udev-node: simplify the example of race 2021-09-12 16:05:51 +09:00
Yu Watanabe ca589b1b41 unit: systemd-oomd.service requires cgroup memory controller 2021-09-12 10:29:29 +09:00
Yu Watanabe 8b2e22579a test-oomd-util: skip tests if cgroup memory controller is not available
Fixes #20593 and #20655.
2021-09-12 10:29:25 +09:00
Yu Watanabe 28fb998615 oomd: refuse to start if cgroup memory controller is not available 2021-09-12 10:28:24 +09:00
Yu Watanabe 594c383554 cgroup-util: use string_hash_ops_free 2021-09-11 20:29:34 +09:00
Yu Watanabe dccdbf9b35 cgroup-util: use _cleanup_free_ attribute 2021-09-11 20:26:58 +09:00
Yu Watanabe ecedc48b19 network: do not drop IPv6LL address in link_drop_addresses() 2021-09-11 10:49:11 +09:00
Yu Watanabe 981fab5d0a network: always call address ready callback if address is ready
The address ready callback is used for cleaning up old addresses or
routes acquired by e.g. DHCP. However, the callback was called only
when the address was previously not ready. So, maybe, unnecessary
addresses or routes may not be cleared.

Also, this makes the callback is called slightly earlier. As it may
remove several addresses or routes, and possibly changes the link state.
2021-09-11 10:49:11 +09:00
Yu Watanabe 18d8a33a37 network: define Address earlier
As the type is used in defining address_ready_callback_t.
2021-09-11 10:49:11 +09:00
Yu Watanabe 7657ec3eb8 network: store IPv6LL address even if link is in failed state
Otherwise, if IPv6LL is received when the link is in failed state,
we may fail to reconfigure the link.
2021-09-11 10:49:11 +09:00
Yu Watanabe 7a8685ffef network: enable IP masquerade when address is assigned
Previously, IP masquerade is enabled when configuring the address. But,
the request of assigning the address may be refused by kernel.
2021-09-11 10:49:11 +09:00
Yu Watanabe 2c40a8895e network: simplify code a bit 2021-09-11 10:49:11 +09:00
Yu Watanabe 160203e974 network: fix handling of network interface renaming
Fixes #20657.
2021-09-10 20:49:05 +02:00
Yu Watanabe 995cc7a72c network: drop unused "after_configure" feature for nexthops, neighbors, and routing policy rules 2021-09-10 19:40:27 +09:00
Yu Watanabe f1c22cf4da network: do not try to drop addresses or routes of unmanaged interfaces on carrier lost
Currently, link_stop_engines(), link_drop_config(), and link_drop_foreign_config()
do nothing when the interface is unmanaged. So this does not change anything.
But returning earlier should be clear and safer for protecting configs
on unmanaged interfaces.
2021-09-10 19:40:27 +09:00
Yu Watanabe dbf8942ab9 network: introduce route_by_kernel() helper function
And drop "FIXME" from comment, as there is nothing we need to fix.
2021-09-10 17:06:24 +09:00
Yu Watanabe 86173383a3 network: introduce ipv4acd_set_ifname() 2021-09-10 17:06:24 +09:00
Yu Watanabe fccf662c3f network: use sd_netlink_message_read_string_strdup() 2021-09-10 17:06:24 +09:00
Yu Watanabe 627191c285 Merge pull request #20693 from mcatanzaro/mcatanzaro/nss-buffers
nss-systemd: ensure returned strings point into provided buffer
2021-09-10 08:43:32 +09:00
Yu Watanabe 771a36439e network: fix wrong flag: manage_foreign_routes -> manage_foreign_rules
Fixes a bug in d94dfe7053.
2021-09-07 20:00:18 +01:00
Yu Watanabe af7c37a486 test: do not try to remove /dev 2021-09-07 14:08:21 +09:00
Yu Watanabe 4e046c5c2f fs-util: rewrite rmdir_parents() with path_find_last_component() 2021-09-07 14:08:21 +09:00
Yu Watanabe 3008a6f21c mkdir: rewrite mkdir_parents() with path_find_{first,last}_component() 2021-09-07 14:08:18 +09:00
Yu Watanabe fe2f05b72e tmpfiles: minor modernization 2021-09-05 10:07:04 +02:00
Yu Watanabe 6a09dbb895 home: 'secret' argument of handle_generic_user_record_error may be null
When RefHome() bus method is called in acquire_home(), secret is NULL.

Fixes #20639.
2021-09-05 10:05:41 +02:00
Yu Watanabe 05403363ca tree-wide: fix typo 2021-09-05 09:09:13 +02:00
Yu Watanabe e643c3d82d network: add 80-container-vb.network 2021-09-04 08:15:34 +09:00
Yu Watanabe b06469a66c test-network: add tests for KeepMaster= 2021-09-04 08:15:30 +09:00
Yu Watanabe 57aef9d737 network: introduce KeepMaster= setting
Closes #20624.
2021-09-04 00:23:20 +09:00
Yu Watanabe 1f024462d1 network: assume enslaved when master ifindex is positive 2021-09-04 00:20:36 +09:00
Yu Watanabe 571bf1aa31 network: use master ifindex to check if the interface is enslaved 2021-09-04 00:20:36 +09:00
Yu Watanabe a94ed9bd62 man: drop unnecessary white space 2021-09-04 00:20:36 +09:00
Yu Watanabe b2cdc2c05e Merge pull request #20603 from yuwata/udev-node-cleanups
udev: cleanups for creating/removing device node symlinks
2021-09-03 05:33:06 +09:00
Yu Watanabe fad45198b6 xattr-util: drop unused path_getcrtime() 2021-09-01 21:36:36 -07:00
Yu Watanabe b57947114e fs-util: use futimens_opath() helper function 2021-09-01 21:36:36 -07:00
Yu Watanabe b71dbc6b56 fs-util: drop unnecessary initialization 2021-09-01 21:36:36 -07:00
Yu Watanabe 7920d0a135 udev-node: drop redundant trial of devlink creation
Previously, the devlink was created based on the priority saved in udev
database. So, we needed to reevaluate devlinks after database is saved.

But now the priority is stored in the symlink under /run/udev/links, and
the loop of devlink creation is controlled with the timestamp of the
directory. So, the double evaluation is not necessary anymore.
2021-09-02 09:06:25 +09:00
Yu Watanabe 0063fa23a1 udev-node: add random delay on conflict in updating device node symlink
To make multiple workers not update the same device node symlink
simultaneously.
2021-09-02 09:06:24 +09:00
Yu Watanabe 8424da2de8 udev-node: shorten code a bit and update log message 2021-09-02 09:06:24 +09:00
Yu Watanabe 1cd4e32569 udev-node: check stack directory change even if devlink is removed
Otherwise, when multiple device additions and removals occur
simultaneously, symlink to unexisting devnode may be created.

Hopefully fixes #19946.
2021-09-02 09:06:24 +09:00
Yu Watanabe 242d39ebc1 udev-node: always atomically create symlink to device node
By the previous commit, it is not necessary to distinguish if the devlink
already exists. Also, I cannot find any significant advantages of the
previous complecated logic, that is, first try to create directly, and then
fallback to atomically creation. Moreover, such logic increases the chance
of conflicts between multiple udev workers.

This makes devlinks always created atomically. Hopefully, this reduces the
conflicts between the workers.
2021-09-02 09:06:24 +09:00
Yu Watanabe 8f27311eb2 udev-node: assume no new claim to a symlink if /run/udev/links is not updated
During creating a symlink to a device node, if another device node which
requests the same symlink is added/removed, `stat_inode_unmodified()`
should always detects that. We do not need to continue the loop
unconditionally.
2021-09-02 09:06:24 +09:00
Yu Watanabe 6df797f75f udev-node: always update timestamp of stack directory
Please see the comments in the code.
2021-09-02 09:06:08 +09:00
Yu Watanabe 377a83f0d8 udev-node: save information about device node and priority in symlink
Previously, we only store device IDs in /run/udev/links, and when
creating/removing device node symlink, we create sd_device object
corresponds to the IDs and read device node and priority from the
object. That requires parsing uevent and udev database files.

This makes link_find_prioritized() get the most prioritzed device node
without parsing the files.
2021-09-02 08:30:51 +09:00
Yu Watanabe 46070dbf26 udev-node: stack directory must exist when adding device node symlink 2021-09-02 08:30:51 +09:00
Yu Watanabe 2f48561e0d udev-node: split out permission handling from udev_node_add()
And then merge udev_node_add() and udev_node_update_old_links().
2021-09-02 08:30:51 +09:00
Yu Watanabe b881ce16b9 sd-device: introduce device_has_devlink() 2021-09-02 08:30:51 +09:00
Yu Watanabe c21d094c65 Merge pull request #20614 from poettering/efi-clean-ups
two minor clean-ups for the efi code
2021-09-02 08:30:07 +09:00
Yu Watanabe bdb492b2ed udev: do not remove control socket on exit
As we usually do, remove old unix socket before bind.

Note that systemd-udevd-control.socket has `RemoveOnStop=yes`.
So, it is not necessary to be removed when the service exits.

Replaces #20584 and #20588.
2021-09-01 14:44:00 +02:00
Yu Watanabe eaba9bb3e6 udev: use link information obtained through netlink 2021-08-31 21:25:02 +09:00
Yu Watanabe 8327fd1b11 udev: introduce link_info_get() 2021-08-31 21:25:02 +09:00
Yu Watanabe d94ab1b27b udev: rename struct netnames -> NetNames 2021-08-31 21:23:24 +09:00
Yu Watanabe 751dcd8d81 udev: use passed rtnl in net_setup_link builtin command 2021-08-31 21:21:10 +09:00
Yu Watanabe 92232230af udev: pass rtnl to builtin commands 2021-08-31 21:21:10 +09:00
Yu Watanabe 1e6ec639f5 udev: simplify get_virtfn_info() 2021-08-31 21:21:00 +09:00
Yu Watanabe ba86989fcd udev: drop redundant chase_symlinks()
`sd_device_new_from_syspath()` internally calls chase_symlinks().
2021-08-31 21:18:49 +09:00
Yu Watanabe 4154524d47 udev: fix potential memleak 2021-08-31 21:18:49 +09:00
Yu Watanabe 416e84192a sd-netlink: introduce sd_netlink_message_get_max_attribute() 2021-08-31 21:18:34 +09:00
Yu Watanabe e0df8e9993 sd-netlink: specify appropriate netlink attribute type 2021-08-31 21:12:20 +09:00
Yu Watanabe 38d3bcde5d sd-netlink: support more rtnl attributes 2021-08-31 21:12:20 +09:00
Yu Watanabe c46bce8b5d basic/linux: add more bridge headers 2021-08-31 21:12:20 +09:00