95 lines
3.3 KiB
Diff
95 lines
3.3 KiB
Diff
From 0af0e37813b5ab7e1ee4a4863f2087bb35173b5a Mon Sep 17 00:00:00 2001
|
|
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
Date: Tue, 4 Feb 2025 09:45:45 +0900
|
|
Subject: [PATCH] test-network: add test case for requesting routing policy
|
|
rules by multiple interfaces
|
|
|
|
For issue #36244.
|
|
|
|
(cherry picked from commit f7ae28fcec9513435f8258431b686fbaf846915b)
|
|
---
|
|
.../25-routing-policy-rule-manual.network | 23 +++++++++++
|
|
test/test-network/systemd-networkd-tests.py | 39 +++++++++++++++++++
|
|
2 files changed, 62 insertions(+)
|
|
create mode 100644 test/test-network/conf/25-routing-policy-rule-manual.network
|
|
|
|
diff --git a/test/test-network/conf/25-routing-policy-rule-manual.network b/test/test-network/conf/25-routing-policy-rule-manual.network
|
|
new file mode 100644
|
|
index 0000000000..fa1328189a
|
|
--- /dev/null
|
|
+++ b/test/test-network/conf/25-routing-policy-rule-manual.network
|
|
@@ -0,0 +1,23 @@
|
|
+# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
+[Match]
|
|
+Name=test1
|
|
+Name=test2
|
|
+
|
|
+[Link]
|
|
+ActivationPolicy=manual
|
|
+
|
|
+[Network]
|
|
+IPv6AcceptRA=no
|
|
+
|
|
+[RoutingPolicyRule]
|
|
+Family=both
|
|
+Priority=10
|
|
+SuppressPrefixLength=0
|
|
+Table=51819
|
|
+
|
|
+[RoutingPolicyRule]
|
|
+Family=both
|
|
+FirewallMark=911
|
|
+InvertRule=true
|
|
+Priority=11
|
|
+Table=51820
|
|
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
|
|
index bb721521a5..4153cf12e8 100755
|
|
--- a/test/test-network/systemd-networkd-tests.py
|
|
+++ b/test/test-network/systemd-networkd-tests.py
|
|
@@ -3874,6 +3874,45 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
|
print(output)
|
|
self.assertIn('10113: from all iif test1 lookup 1011', output)
|
|
|
|
+ def test_routing_policy_rule_manual(self):
|
|
+ # For issue #36244.
|
|
+ copy_network_unit(
|
|
+ '11-dummy.netdev',
|
|
+ '25-routing-policy-rule-manual.network')
|
|
+ start_networkd()
|
|
+ self.wait_operstate('test1', operstate='off', setup_state='configuring', setup_timeout=20)
|
|
+
|
|
+ check_output('ip link add test2 type dummy')
|
|
+ self.wait_operstate('test2', operstate='off', setup_state='configuring', setup_timeout=20)
|
|
+
|
|
+ networkctl('up', 'test2')
|
|
+ self.wait_online('test2:degraded')
|
|
+
|
|
+ # The request for the routing policy rules are bound to test1. Hence, we need to wait for the rules
|
|
+ # being configured explicitly.
|
|
+ for _ in range(20):
|
|
+ time.sleep(0.5)
|
|
+
|
|
+ output = check_output('ip -4 rule list table 51819')
|
|
+ if output != '10: from all lookup 51819 suppress_prefixlength 0 proto static':
|
|
+ continue
|
|
+
|
|
+ output = check_output('ip -6 rule list table 51819')
|
|
+ if output != '10: from all lookup 51819 suppress_prefixlength 0 proto static':
|
|
+ continue
|
|
+
|
|
+ output = check_output('ip -4 rule list table 51820')
|
|
+ if output != '11: not from all fwmark 0x38f lookup 51820 proto static':
|
|
+ continue
|
|
+
|
|
+ output = check_output('ip -6 rule list table 51820')
|
|
+ if output != '11: not from all fwmark 0x38f lookup 51820 proto static':
|
|
+ continue
|
|
+
|
|
+ break
|
|
+ else:
|
|
+ self.assertFalse(True)
|
|
+
|
|
@expectedFailureIfRoutingPolicyPortRangeIsNotAvailable()
|
|
def test_routing_policy_rule_port_range(self):
|
|
copy_network_unit('25-fibrule-port-range.network', '11-dummy.netdev')
|