summaryrefslogtreecommitdiff
path: root/src/network/networkd-link.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-07-22 08:32:39 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-07-23 20:04:22 +0900
commit1fd3ac1eef8889d148f3a6e9da5e656e71f60af0 (patch)
tree247d5dd49fb35e9d3b5db2e329fc1e75e22386ad /src/network/networkd-link.c
parent8de56fb3e04d1018aaac607ce435c61138b22bca (diff)
downloadsystemd-1fd3ac1eef8889d148f3a6e9da5e656e71f60af0.tar.gz
network: introduce a tiny wrapper for manager_udev_process_link()
Preparation for later commits.
Diffstat (limited to 'src/network/networkd-link.c')
-rw-r--r--src/network/networkd-link.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/network/networkd-link.c b/src/network/networkd-link.c
index bf48331129..8b0ef8f076 100644
--- a/src/network/networkd-link.c
+++ b/src/network/networkd-link.c
@@ -1488,21 +1488,13 @@ static int link_check_initialized(Link *link) {
return link_initialized(link, device);
}
-int manager_udev_process_link(sd_device_monitor *monitor, sd_device *device, void *userdata) {
- sd_device_action_t action;
- Manager *m = userdata;
- Link *link = NULL;
+int manager_udev_process_link(Manager *m, sd_device *device, sd_device_action_t action) {
int r, ifindex;
+ Link *link;
assert(m);
assert(device);
- r = sd_device_get_action(device, &action);
- if (r < 0) {
- log_device_debug_errno(device, r, "Failed to get udev action, ignoring device: %m");
- return 0;
- }
-
/* Ignore the "remove" uevent — let's remove a device only if rtnetlink says so. All other uevents
* are "positive" events in some form, i.e. inform us about a changed or new network interface, that
* still exists — and we are interested in that. */
@@ -1510,25 +1502,20 @@ int manager_udev_process_link(sd_device_monitor *monitor, sd_device *device, voi
return 0;
r = sd_device_get_ifindex(device, &ifindex);
- if (r < 0) {
- log_device_debug_errno(device, r, "Ignoring udev %s event for device without ifindex or with invalid ifindex: %m",
- device_action_to_string(action));
- return 0;
- }
+ if (r < 0)
+ return log_device_debug_errno(device, r, "Failed to get ifindex: %m");
r = device_is_renaming(device);
- if (r < 0) {
- log_device_debug_errno(device, r, "Failed to determine the device is renamed or not, ignoring '%s' uevent: %m",
- device_action_to_string(action));
- return 0;
- }
+ if (r < 0)
+ return log_device_debug_errno(device, r, "Failed to determine if the device is renaming or not: %m");
if (r > 0) {
- log_device_debug(device, "Interface is under renaming, wait for the interface to be renamed.");
+ log_device_debug(device, "Device is renaming, waiting for the interface to be renamed.");
return 0;
}
r = link_get_by_index(m, ifindex, &link);
if (r < 0) {
+ /* This error is not critical, as the corresponding rtnl message may be received later. */
log_device_debug_errno(device, r, "Failed to get link from ifindex %i, ignoring: %m", ifindex);
return 0;
}