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)