]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network/route: fix unexpected removal of routes for wireguard
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 16 May 2024 21:40:40 +0000 (06:40 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 16 May 2024 21:40:43 +0000 (06:40 +0900)
Fixes a bug introduced by 8d01e44c1f0e00b414d36bd1b46ecff548242208.

If a .netdev file for a wireguard interface requests to configure
routes for the interface, the routes were removed during configuring
another interface.

Fixes #32859.

src/network/networkd-route.c

index a4c56f1bbd6554acda5b84e7454b3100bac0b055..3e0b25ff3deca1d9747b2e3620be64e7e3baf927 100644 (file)
@@ -1430,16 +1430,16 @@ static int link_mark_routes(Link *link, bool foreign) {
                                 }
                         }
                 }
-        }
 
-        /* Also unmark routes requested in .netdev file. */
-        if (foreign && link->netdev && link->netdev->kind == NETDEV_KIND_WIREGUARD) {
-                Wireguard *w = WIREGUARD(link->netdev);
+                /* Also unmark routes requested in .netdev file. */
+                if (other->netdev && other->netdev->kind == NETDEV_KIND_WIREGUARD) {
+                        Wireguard *w = WIREGUARD(other->netdev);
 
-                SET_FOREACH(route, w->routes) {
-                        r = link_unmark_route(link, route, NULL);
-                        if (r < 0)
-                                return r;
+                        SET_FOREACH(route, w->routes) {
+                                r = link_unmark_route(other, route, NULL);
+                                if (r < 0)
+                                        return r;
+                        }
                 }
         }