Skip to content

Commit b641ced

Browse files
yuwatakeszybz
authored andcommitted
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. (cherry picked from commit e091ed4)
1 parent 056186b commit b641ced

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/network/networkd-route-util.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ bool gateway_is_ready(Link *link, bool onlink, int family, const union in_addr_u
162162
continue;
163163
if (FLAGS_SET(a->flags, IFA_F_NOPREFIXROUTE))
164164
continue;
165-
if (in_addr_is_set(a->family, &a->in_addr_peer))
166-
continue;
167-
if (in_addr_prefix_covers(family, &a->in_addr, a->prefixlen, gw) > 0)
165+
if (in_addr_prefix_covers(a->family,
166+
in_addr_is_set(a->family, &a->in_addr_peer) ? &a->in_addr_peer : &a->in_addr,
167+
a->prefixlen, gw) > 0)
168168
return true;
169169
}
170170

0 commit comments

Comments
 (0)