]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: also drop requests when link enters linger state
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 17 May 2021 06:32:57 +0000 (15:32 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 18 May 2021 11:40:56 +0000 (20:40 +0900)
Otherwise, if link is removed, several references to the link in remain
exist in requests.

src/network/networkd-link.c

index 67d01ac44d8b2589b5fb471326a3d7ffe495d5ab..b56c232ecae100c447889092f920b875a74b41b7 100644 (file)
@@ -1771,6 +1771,17 @@ static void link_drop_from_master(Link *link, NetDev *netdev) {
         link_unref(set_remove(master->slaves, link));
 }
 
+static void link_drop_requests(Link *link) {
+        Request *req;
+
+        assert(link);
+        assert(link->manager);
+
+        ORDERED_SET_FOREACH(req, link->manager->request_queue)
+                if (req->link == link)
+                        request_drop(req);
+}
+
 static void link_drop(Link *link) {
         if (!link)
                 return;
@@ -1782,6 +1793,8 @@ static void link_drop(Link *link) {
         /* Drop all references from other links and manager. Note that async netlink calls may have
          * references to the link, and they will be dropped when we receive replies. */
 
+        link_drop_requests(link);
+
         link_free_carrier_maps(link);
 
         if (link->network) {
@@ -2098,17 +2111,6 @@ static int link_drop_config(Link *link) {
         return r;
 }
 
-static void link_drop_requests(Link *link) {
-        Request *req;
-
-        assert(link);
-        assert(link->manager);
-
-        ORDERED_SET_FOREACH(req, link->manager->request_queue)
-                if (req->link == link)
-                        request_drop(req);
-}
-
 int link_configure(Link *link) {
         int r;