From: Yu Watanabe Date: Thu, 16 May 2024 21:40:40 +0000 (+0900) Subject: network/route: fix unexpected removal of routes for wireguard X-Git-Tag: v256-rc3~45^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7769b4d8ea5ed601b79d8708d360f5c83bd39e9;p=thirdparty%2Fsystemd.git network/route: fix unexpected removal of routes for wireguard 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. --- diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index a4c56f1bbd6..3e0b25ff3de 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -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; + } } }