Skip to content

Commit be2c9ed

Browse files
yuwatabluca
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) (cherry picked from commit b641ced) (cherry picked from commit 752b9b0)
1 parent fd7205f commit be2c9ed

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
@@ -153,9 +153,9 @@ bool gateway_is_ready(Link *link, bool onlink, int family, const union in_addr_u
153153
continue;
154154
if (FLAGS_SET(a->flags, IFA_F_NOPREFIXROUTE))
155155
continue;
156-
if (in_addr_is_set(a->family, &a->in_addr_peer))
157-
continue;
158-
if (in_addr_prefix_covers(family, &a->in_addr, a->prefixlen, gw) > 0)
156+
if (in_addr_prefix_covers(a->family,
157+
in_addr_is_set(a->family, &a->in_addr_peer) ? &a->in_addr_peer : &a->in_addr,
158+
a->prefixlen, gw) > 0)
159159
return true;
160160
}
161161

0 commit comments

Comments
 (0)