]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: route: handle null address with non-zero prefixlen correctly 21633/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 5 Dec 2021 15:29:39 +0000 (00:29 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 6 Dec 2021 10:16:17 +0000 (19:16 +0900)
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

index c57adbe0ab0a671e3540aa6c070ae34d83c2b082..f5b502f46443e85b65e40ec9eda4e09794d7457f 100644 (file)
@@ -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;