Commit Graph
100 Commits
Author SHA1 Message Date
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 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
Yu Watanabe 6771b85d98 network/netdev: append IFLA_INFO_DATA attribute only when it is necessary 2021-08-31 21:12:20 +09:00
Yu Watanabe e658a37326 Merge pull request #20567 from yuwata/socket-additional-cmsg-buffer
socket-util: add additional cmsg buffer for 64bit timeval or timespec
2021-08-31 13:54:18 +09:00
Yu Watanabe fb6ba2521c Merge pull request #20583 from poettering/pk-no-tty
some polkit agent tweaks
2021-08-31 13:45:04 +09:00
Yu Watanabe 827d1ba730 core: fix typo: they -> the 2021-08-30 22:25:54 +09:00
Yu Watanabe 37df6d9b8d timesync: check cmsg length 2021-08-30 19:56:44 +09:00
Yu Watanabe 9365e296fe socket-util: introduce CMSG_SPACE_TIMEVAL/TIMESPEC macro to support additional 64bit timeval or timespec
Fixes #20482 and #20564.
2021-08-30 19:56:41 +09:00
Yu Watanabe 4917c15af7 Merge pull request #20057 from yuwata/sd-netlink-genl-cleanups
sd-netlink: cleanups for generic netlink
2021-08-29 22:37:31 +09:00
Yu Watanabe 98be429243 sd-netlink: make type_system_get_*() and friends return value directly 2021-08-29 18:10:47 +09:00
Yu Watanabe e1578f608b sd-netlink: introduce sd_genl_add_match()
By using this, we can listen multicast messages for generic netlink.
2021-08-29 18:10:47 +09:00
Yu Watanabe 3f60e4488c sd-netlink: split sd_netlink_add_match() into two parts
This also makes netlink_slot_disconnect() correctly unref multicast
groups.
2021-08-29 18:10:47 +09:00
Yu Watanabe ef90beb1c5 sd-netlink: introduce sd_genl_message_get_command() 2021-08-29 18:10:47 +09:00
Yu Watanabe 44f1072a9d sd-netlink: determine header size of genl message by using CTRL_ATTR_HDRSIZE attribute
Fortunately, all genl families we currently use do not require additional
header size.
2021-08-29 18:10:47 +09:00
Yu Watanabe 52313394ba sd-netlink: read protocol version of each genl family 2021-08-29 18:10:47 +09:00
Yu Watanabe 56fdc16da8 sd-netlink: drop sd_genl_family_t and introduce GenericNetlinkFamily
Kernel manages each genl family by its name, e.g. "nlctrl" or WG_GENL_NAME,
and its ID (used for nlmsg_type) is determined dynamically when the
corresponding module is loaded.

This commit makes sd-netlink follow the same way; now, sd_genl_family_t
is dropped, and sd_genl_message_new() takes a genl family name. Each
genl family is resolved when it is used first time, and its information
is stored in GenericNetlinkFamily.
2021-08-29 18:10:43 +09:00
Yu Watanabe 1cedca05e4 sd-netlink: split message_new() into two parts and introduces message_new_full() 2021-08-29 18:01:26 +09:00
Yu Watanabe 699c3708df sd-netlink: introduce several macros to define type system 2021-08-29 18:01:26 +09:00
Yu Watanabe e6dd298935 sd-netlink: drop redundant string table lookup functions to handle type system union 2021-08-29 18:01:26 +09:00
Yu Watanabe fae9ee25a4 sd-netlink: split type system for nfnl
This makes the root type system for nfnl indexed by subsystem, and
itroduces a next level type system for each subsystem. The second
level type systems are indexed by message types correspond to each
subsystem.
2021-08-29 18:01:26 +09:00
Yu Watanabe 07acd0d90b sd-netlink: drop 'flags' argument from sd_nfnl_nft_message_new_table() 2021-08-29 18:01:26 +09:00
Yu Watanabe c08ab4a013 sd-netlink: wrap long function declarations 2021-08-29 18:01:26 +09:00
Yu Watanabe 9a9c8f3fcc sd-netlink: add several missing attributes 2021-08-29 18:01:26 +09:00
Yu Watanabe 1370925bc7 basic: copy genetlink.h to repository 2021-08-29 18:01:26 +09:00
Yu Watanabe aee6309b97 sd-netlink: introduce basic_type_system
Preparation for later commits.
2021-08-29 18:01:26 +09:00
Yu Watanabe d757e6bdf0 sd-netlink: unify two spurious type system root for genl 2021-08-29 18:01:26 +09:00
Yu Watanabe 9270ec60bc sd-netlink: drop genl type system indexed by command
All type systems of currently supported genl families do not depend on
commands. Hence, at least tentatively, let's drop the tables.

Note that type system for genl ethtool depends on commands. Let's
reintroduce a mechanism to support the deps when we support ethtool on
netlink.
2021-08-29 18:01:26 +09:00
Yu Watanabe e6d58c2f71 sd-netlink: rename several type systems for generic netlink 2021-08-29 18:01:26 +09:00
Yu Watanabe 021273b782 sd-netlink: split netlink-types.[ch] into small files
Also renames several files.
2021-08-29 18:01:22 +09:00
Yu Watanabe b5beb9b0f5 sd-netlink: make several type systems static 2021-08-29 17:18:11 +09:00
Yu Watanabe 0dac2688a4 sd-netlink: move type systems 2021-08-29 17:18:11 +09:00
Yu Watanabe b019c545e9 sd-netlink: introduce two helper functions for type system union 2021-08-29 17:18:11 +09:00
Yu Watanabe ea073c8fce sd-netlink: rename functions 2021-08-29 17:18:04 +09:00
Yu Watanabe 49eb0a6889 sd-netlink: make type_get_type_system{,_union}() return value directly 2021-08-29 17:14:07 +09:00
Yu Watanabe c737abd31b sd-netlink: make message_seal() accept already sealed messages
The function can be idempotent. It is not necessary to refuse already
sealed messages.
2021-08-29 17:14:07 +09:00
Yu Watanabe 409856d328 sd-netlink: rename variables, arguments, and functions
Most changes are 'rtnl' -> 'nl' where the function is not only for rtnl.
2021-08-29 17:14:03 +09:00
Yu Watanabe 0c45a60f8e test: add usual log messages in test-netlink 2021-08-29 17:11:40 +09:00
Yu Watanabe 9d7fbec1e5 sd-netlink: drop unused type 2021-08-29 17:11:40 +09:00
Yu Watanabe a9cd516f6c Merge pull request #20553 from weblate/weblate-systemd-master
Translations update from Weblate
2021-08-27 03:09:29 +09:00
Yu Watanabe cacf882ff3 Merge pull request #20541 from yuwata/udev-coalesce-follow-up
udev: follow-ups for coalesce feature support
2021-08-26 06:05:29 +09:00
Yu Watanabe d11ff2a4f1 Merge pull request #20515 from yuwata/pid1-mount-apivfs-no
pid1: make find_executable() work with MountAPIVFS=no
2021-08-26 06:05:03 +09:00
Yu Watanabe ebab417cfb Merge pull request #20531 from DaanDeMeyer/fix-17433
core: Check unit start rate limiting earlier
2021-08-26 06:04:40 +09:00
Yu Watanabe ee7512404b udev/net: initialize coalesce tristate variables
Otherwise, 99-default.link may introduce something like the
following warnings:
----
Aug 26 03:23:59 systemd-udevd[519]: wlan0: Could not set coalesce settings, ignoring: Operation not supported
Aug 26 03:24:00 systemd-udevd[547]: wlp59s0: Could not set coalesce settings, ignoring: Operation not supported
----

Follow-up for 6c35ea5ef0.
2021-08-26 03:36:18 +09:00
Yu Watanabe 72328a5977 ethtool: move function
I'd like to locate all conf parsers at end of file.
2021-08-26 03:32:39 +09:00
Yu Watanabe 42867dfeef test-execute: add a testcase for MountAPIVFS=no 2021-08-26 02:54:37 +09:00
Yu Watanabe e243d78c30 Merge pull request #20524 from weblate/weblate-systemd-master
Translations update from Weblate
2021-08-24 03:28:06 +09:00
Yu Watanabe aa2727517e test-execute: logs can_share flag 2021-08-24 02:04:24 +09:00
Yu Watanabe 93413acd3e path-util: make find_executable() work without /proc mounted
Follow-up for 888f65ace6.

Hopefully fixes #20514.
2021-08-24 02:04:24 +09:00
Yu Watanabe ded8039abe path-util: split out common part in find_executable_full() 2021-08-24 02:04:24 +09:00
Yu Watanabe 3a1220eedf Merge pull request #20513 from yuwata/network-allow-deny-list-take-prefix-length
network: dhcp4,ndisc: make addresses in Allow/DenyList= optionally take prefix length
2021-08-24 02:01:51 +09:00
Yu Watanabe ab47f96041 test-network: add more testcases for *Allow/DenyList= 2021-08-23 20:37:36 +09:00