From: Yu Watanabe Date: Sun, 10 Dec 2023 04:56:46 +0000 (+0900) Subject: network/route: fix reachability check when peer address is specified X-Git-Tag: v256-rc1~1530^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e091ed405353624f2da28e2f3210e205f7eab370;p=thirdparty%2Fsystemd.git network/route: fix reachability check when peer address is specified When an address with peer address is specified, the kernel by default adds the prefix route for the peer address. When ManageForeignRoute=no is set, then we also needs to check the prefix for the peer address. Fixes #30403. --- diff --git a/src/network/networkd-route-util.c b/src/network/networkd-route-util.c index a204fb96319..d49a0b95124 100644 --- a/src/network/networkd-route-util.c +++ b/src/network/networkd-route-util.c @@ -162,9 +162,9 @@ bool gateway_is_ready(Link *link, bool onlink, int family, const union in_addr_u continue; if (FLAGS_SET(a->flags, IFA_F_NOPREFIXROUTE)) continue; - if (in_addr_is_set(a->family, &a->in_addr_peer)) - continue; - if (in_addr_prefix_covers(family, &a->in_addr, a->prefixlen, gw) > 0) + if (in_addr_prefix_covers(a->family, + in_addr_is_set(a->family, &a->in_addr_peer) ? &a->in_addr_peer : &a->in_addr, + a->prefixlen, gw) > 0) return true; }