From 72fd133dca7c6adfc9956281b51bc5548bc9235e Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 10 Sep 2024 00:17:11 +0900 Subject: [PATCH] network/route: use NetDev object assigned to Link --- src/network/networkd-route.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/network/networkd-route.c b/src/network/networkd-route.c index 9e383ee6e8c..859a3cf4cd8 100644 --- a/src/network/networkd-route.c +++ b/src/network/networkd-route.c @@ -1008,19 +1008,15 @@ static int static_route_handler(sd_netlink *rtnl, sd_netlink_message *m, Request } static int link_request_wireguard_routes(Link *link, bool only_ipv4) { - NetDev *netdev; Route *route; int r; assert(link); - if (!streq_ptr(link->kind, "wireguard")) + if (!link->netdev || link->netdev->kind != NETDEV_KIND_WIREGUARD) return 0; - if (netdev_get(link->manager, link->ifname, &netdev) < 0) - return 0; - - Wireguard *w = WIREGUARD(netdev); + Wireguard *w = WIREGUARD(link->netdev); SET_FOREACH(route, w->routes) { if (only_ipv4 && route->family != AF_INET)