network: fix handling of routing policy rule fwmask
The firewall mask should be applied even if the mark is 0, to allow defining a value of e.g. 0/255. Fixes #36973
This commit is contained in:
committed by
Yu Watanabe
parent
49ff90c70d
commit
ec65c29e51
@@ -48,6 +48,24 @@ From=10.1.0.0/16
|
||||
Priority=104
|
||||
Table=12
|
||||
|
||||
[RoutingPolicyRule]
|
||||
IncomingInterface=test1
|
||||
FirewallMark=0/1
|
||||
Priority=200
|
||||
Table=20
|
||||
|
||||
[RoutingPolicyRule]
|
||||
IncomingInterface=test1
|
||||
FirewallMark=7/255
|
||||
Priority=201
|
||||
Table=21
|
||||
|
||||
[RoutingPolicyRule]
|
||||
IncomingInterface=test1
|
||||
FirewallMark=9999
|
||||
Priority=202
|
||||
Table=22
|
||||
|
||||
# The four routing policy rules below intentionally have the same config
|
||||
# excepts for their To= addresses. See issue #35874.
|
||||
[RoutingPolicyRule]
|
||||
|
||||
@@ -3890,6 +3890,18 @@ 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 iif test1 priority 200')
|
||||
print(output)
|
||||
self.assertIn('200: from all fwmark 0/0x1 iif test1 lookup 20', output)
|
||||
|
||||
output = check_output('ip rule list iif test1 priority 201')
|
||||
print(output)
|
||||
self.assertIn('201: from all fwmark 0x7/0xff iif test1 lookup 21', output)
|
||||
|
||||
output = check_output('ip rule list iif test1 priority 202')
|
||||
print(output)
|
||||
self.assertIn('202: from all fwmark 0x270f iif test1 lookup 22', 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)
|
||||
|
||||
Reference in New Issue
Block a user