]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: call netlink in the last of route_configure() 17400/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 20 Oct 2020 06:44:21 +0000 (15:44 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 20 Oct 2020 06:44:24 +0000 (15:44 +0900)
Otherwise, assertion will be hit when route_add() fails.

src/network/networkd-route.c

index 85d540c32ab0f9f67ea82f402765eaa442626e9b..dd05e11067be05ec5a8db6f02b52b9265b9f2795 100644 (file)
@@ -1119,13 +1119,6 @@ int route_configure(
         if (r < 0)
                 return log_link_error_errno(link, r, "Could not append RTA_MULTIPATH attribute: %m");
 
-        r = netlink_call_async(link->manager->rtnl, NULL, req, callback,
-                               link_netlink_destroy_callback, link);
-        if (r < 0)
-                return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
-
-        link_ref(link);
-
         if (ordered_set_isempty(route->multipath_routes)) {
                 Route *nr;
 
@@ -1147,6 +1140,13 @@ int route_configure(
                 }
         }
 
+        r = netlink_call_async(link->manager->rtnl, NULL, req, callback,
+                               link_netlink_destroy_callback, link);
+        if (r < 0)
+                return log_link_error_errno(link, r, "Could not send rtnetlink message: %m");
+
+        link_ref(link);
+
         return 0;
 }