Merge pull request #32875 from yuwata/network-route-wireguard

network/route: fix unexpected removal of routes for wireguard
This commit is contained in:
Daan De Meyer 2024-05-17 09:10:33 +02:00 committed by GitHub
commit c84b7a5743
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 12 deletions

View file

@ -1430,16 +1430,16 @@ static int link_mark_routes(Link *link, bool foreign) {
}
}
}
}
/* Also unmark routes requested in .netdev file. */
if (foreign && link->netdev && link->netdev->kind == NETDEV_KIND_WIREGUARD) {
Wireguard *w = WIREGUARD(link->netdev);
/* Also unmark routes requested in .netdev file. */
if (other->netdev && other->netdev->kind == NETDEV_KIND_WIREGUARD) {
Wireguard *w = WIREGUARD(other->netdev);
SET_FOREACH(route, w->routes) {
r = link_unmark_route(link, route, NULL);
if (r < 0)
return r;
SET_FOREACH(route, w->routes) {
r = link_unmark_route(other, route, NULL);
if (r < 0)
return r;
}
}
}

View file

@ -96,7 +96,7 @@ MultiPathRoute=149.10.124.59 10
MultiPathRoute=149.10.124.60 5
[Route]
Destination=2001:1234:5:7fff:ff:ff:ff:ff/128
Destination=2001:1234:5:bfff:ff:ff:ff:ff/128
MultiPathRoute=2001:1234:5:6fff:ff:ff:ff:ff@test1 20
MultiPathRoute=2001:1234:5:7fff:ff:ff:ff:ff@test1 30
MultiPathRoute=2001:1234:5:8fff:ff:ff:ff:ff@dummy98 10

View file

@ -3445,11 +3445,11 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertIn('dev dummy98 weight 10', output)
self.assertIn('dev dummy98 weight 5', output)
print('### ip -6 route show 2001:1234:5:7fff:ff:ff:ff:ff')
output = check_output('ip -6 route show 2001:1234:5:7fff:ff:ff:ff:ff')
print('### ip -6 route show 2001:1234:5:bfff:ff:ff:ff:ff')
output = check_output('ip -6 route show 2001:1234:5:bfff:ff:ff:ff:ff')
print(output)
# old ip command does not show 'nexthop' keyword and weight...
self.assertIn('2001:1234:5:7fff:ff:ff:ff:ff', output)
self.assertIn('2001:1234:5:bfff:ff:ff:ff:ff', output)
self.assertIn('via 2001:1234:5:6fff:ff:ff:ff:ff dev test1', output)
self.assertIn('via 2001:1234:5:7fff:ff:ff:ff:ff dev test1', output)
self.assertIn('via 2001:1234:5:8fff:ff:ff:ff:ff dev dummy98', output)