1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

network/route: use NetDev object assigned to Link

This commit is contained in:
Yu Watanabe 2024-09-10 00:17:11 +09:00
parent 1788c34628
commit 72fd133dca

View File

@ -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)