summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-10-31 20:56:12 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-11-14 02:17:19 +0100
commit259125d53d98541623b69e83000b5543f2352f5e (patch)
treed8eab09671bdf12d278a63d659ce653b57e6229c
parentnetwork/netdev: enter ready state only when it is created by us (diff)
downloadsystemd-259125d53d98541623b69e83000b5543f2352f5e.tar.xz
systemd-259125d53d98541623b69e83000b5543f2352f5e.zip
network/netdev: always queue request of creating netdev then process it later
After PR #34909, networkd tries to update an existing netdev interface if possible. But, when .netdev files are loaded on start, we have not enumerate interfaces, so we do not know if the corresponding interface exists or not. Let's delay processing request a bit.
-rw-r--r--src/network/netdev/netdev.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/network/netdev/netdev.c b/src/network/netdev/netdev.c
index 67a98576fd..32050ecf60 100644
--- a/src/network/netdev/netdev.c
+++ b/src/network/netdev/netdev.c
@@ -965,21 +965,9 @@ static int netdev_request_to_create(NetDev *netdev) {
if (netdev->state != NETDEV_STATE_LOADING)
return 0; /* Already configured (at least tried previously). Not necessary to reconfigure. */
- r = netdev_is_ready_to_create(netdev, NULL);
+ r = netdev_queue_request(netdev, independent_netdev_process_request, NULL);
if (r < 0)
- return r;
- if (r > 0) {
- /* If the netdev has no dependency, then create it now. */
- r = independent_netdev_create(netdev);
- if (r < 0)
- return log_netdev_warning_errno(netdev, r, "Failed to create netdev: %m");
-
- } else {
- /* Otherwise, wait for the dependencies being resolved. */
- r = netdev_queue_request(netdev, independent_netdev_process_request, NULL);
- if (r < 0)
- return log_netdev_warning_errno(netdev, r, "Failed to request to create netdev: %m");
- }
+ return log_netdev_warning_errno(netdev, r, "Failed to request to create netdev: %m");
return 0;
}