mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
network/routing-policy-rule: fix compare function (#36268)
Fixes a regression caused by fc58350aa4
(v257).
Fixes #35874.
This commit is contained in:
@@ -318,7 +318,7 @@ static int routing_policy_rule_compare_func_full(const RoutingPolicyRule *a, con
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
if (all) {
|
||||
if (a->family == b->family && a->family != AF_UNSPEC) {
|
||||
r = memcmp(&a->from.address, &b->from.address, FAMILY_ADDRESS_SIZE(a->family));
|
||||
if (r != 0)
|
||||
return r;
|
||||
|
||||
@@ -47,3 +47,21 @@ IncomingInterface=test1
|
||||
From=10.1.0.0/16
|
||||
Priority=104
|
||||
Table=12
|
||||
|
||||
# The four routing policy rules below intentionally have the same config
|
||||
# excepts for their To= addresses. See issue #35874.
|
||||
[RoutingPolicyRule]
|
||||
To=192.0.2.0/26
|
||||
Table=1001
|
||||
|
||||
[RoutingPolicyRule]
|
||||
To=192.0.2.64/26
|
||||
Table=1001
|
||||
|
||||
[RoutingPolicyRule]
|
||||
To=192.0.2.128/26
|
||||
Table=1001
|
||||
|
||||
[RoutingPolicyRule]
|
||||
To=192.0.2.192/26
|
||||
Table=1001
|
||||
|
||||
@@ -3847,6 +3847,22 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertIn('104: from 10.1.0.0/16 iif test1 lookup 12 nop', output)
|
||||
|
||||
output = check_output('ip rule list to 192.0.2.0/26')
|
||||
print(output)
|
||||
self.assertIn('to 192.0.2.0/26 lookup 1001', output)
|
||||
|
||||
output = check_output('ip rule list to 192.0.2.64/26')
|
||||
print(output)
|
||||
self.assertIn('to 192.0.2.64/26 lookup 1001', output)
|
||||
|
||||
output = check_output('ip rule list to 192.0.2.128/26')
|
||||
print(output)
|
||||
self.assertIn('to 192.0.2.128/26 lookup 1001', output)
|
||||
|
||||
output = check_output('ip rule list to 192.0.2.192/26')
|
||||
print(output)
|
||||
self.assertIn('to 192.0.2.192/26 lookup 1001', output)
|
||||
|
||||
def check_routing_policy_rule_dummy98(self):
|
||||
print('### Checking routing policy rules requested by dummy98')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user