From cf477495d6778f96677c15c8a8e49147d6d742cd Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 6 Dec 2021 00:29:39 +0900 Subject: [PATCH] network: route: handle null address with non-zero prefixlen correctly Previously, even if a link has a route to e.g. ::/96, default gateway via ::1.2.3.4 cannot be configured. --- src/network/networkd-route-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/networkd-route-util.c b/src/network/networkd-route-util.c index c57adbe0ab0..f5b502f4644 100644 --- a/src/network/networkd-route-util.c +++ b/src/network/networkd-route-util.c @@ -116,7 +116,7 @@ static bool link_address_is_reachable(Link *link, int family, const union in_add continue; if (route->family != family) continue; - if (!in_addr_is_set(route->family, &route->dst)) + if (!in_addr_is_set(route->family, &route->dst) && route->dst_prefixlen == 0) continue; if (in_addr_prefix_covers(family, &route->dst, route->dst_prefixlen, address) > 0) return true; -- 2.47.3