summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2019-02-22 12:28:51 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2019-02-27 19:24:13 +0900
commitb677774d6958435bead38202e61509139b06b497 (patch)
tree7b47627c8c8d785f7009acde40491b47fc706c97
parent703bc7a2a67af315d2515b55d06eba63cf6ba9f1 (diff)
downloadsystemd-b677774d6958435bead38202e61509139b06b497.tar.gz
systemd-b677774d6958435bead38202e61509139b06b497.tar.bz2
systemd-b677774d6958435bead38202e61509139b06b497.zip
test-network: add testcase for issue #11280
-rw-r--r--test/test-network/conf/routing-policy-rule-dummy98.network10
-rw-r--r--test/test-network/conf/routing-policy-rule-test1.network (renamed from test/test-network/conf/routing-policy-rule.network)0
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py35
3 files changed, 41 insertions, 4 deletions
diff --git a/test/test-network/conf/routing-policy-rule-dummy98.network b/test/test-network/conf/routing-policy-rule-dummy98.network
new file mode 100644
index 0000000000..8136c20ae4
--- /dev/null
+++ b/test/test-network/conf/routing-policy-rule-dummy98.network
@@ -0,0 +1,10 @@
+[Match]
+Name=dummy98
+
+[RoutingPolicyRule]
+TypeOfService=0x08
+Table=8
+From= 192.168.101.18
+Priority=112
+IncomingInterface=dummy98
+OutgoingInterface=dummy98
diff --git a/test/test-network/conf/routing-policy-rule.network b/test/test-network/conf/routing-policy-rule-test1.network
index 46b87c5a9a..46b87c5a9a 100644
--- a/test/test-network/conf/routing-policy-rule.network
+++ b/test/test-network/conf/routing-policy-rule-test1.network
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 8600b56e4c..4a5109d9a0 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -165,8 +165,9 @@ class Utilities():
if os.path.exists(dnsmasq_log_file):
os.remove(dnsmasq_log_file)
- def start_networkd(self):
- if (os.path.exists(os.path.join(networkd_runtime_directory, 'state'))):
+ def start_networkd(self, remove_state_files=True):
+ if (remove_state_files and
+ os.path.exists(os.path.join(networkd_runtime_directory, 'state'))):
subprocess.check_call('systemctl stop systemd-networkd', shell=True)
os.remove(os.path.join(networkd_runtime_directory, 'state'))
subprocess.check_call('systemctl start systemd-networkd', shell=True)
@@ -601,7 +602,8 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
'25-sysctl-disable-ipv6.network',
'25-sysctl.network',
'configure-without-carrier.network',
- 'routing-policy-rule.network',
+ 'routing-policy-rule-dummy98.network',
+ 'routing-policy-rule-test1.network',
'test-static.network']
def setUp(self):
@@ -658,7 +660,7 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'primary test1')
def test_routing_policy_rule(self):
- self.copy_unit_to_networkd_unit_path('routing-policy-rule.network', '11-dummy.netdev')
+ self.copy_unit_to_networkd_unit_path('routing-policy-rule-test1.network', '11-dummy.netdev')
subprocess.call(['ip', 'rule', 'del', 'table', '7'])
@@ -677,6 +679,31 @@ class NetworkdNetWorkTests(unittest.TestCase, Utilities):
subprocess.call(['ip', 'rule', 'del', 'table', '7'])
+ def test_routing_policy_rule_issue_11280(self):
+ self.copy_unit_to_networkd_unit_path('routing-policy-rule-test1.network', '11-dummy.netdev',
+ 'routing-policy-rule-dummy98.network', '12-dummy.netdev')
+
+ subprocess.call(['ip', 'rule', 'del', 'table', '7'])
+ subprocess.call(['ip', 'rule', 'del', 'table', '8'])
+
+ for trial in range(3):
+ # Remove state files only first time
+ self.start_networkd(trial == 0)
+
+ self.assertTrue(self.link_exits('test1'))
+ self.assertTrue(self.link_exits('dummy98'))
+
+ output = subprocess.check_output(['ip', 'rule', 'list', 'table', '7']).rstrip().decode('utf-8')
+ print(output)
+ self.assertRegex(output, '111: from 192.168.100.18 tos (?:0x08|throughput) iif test1 oif test1 lookup 7')
+
+ output = subprocess.check_output(['ip', 'rule', 'list', 'table', '8']).rstrip().decode('utf-8')
+ print(output)
+ self.assertRegex(output, '112: from 192.168.101.18 tos (?:0x08|throughput) iif dummy98 oif dummy98 lookup 8')
+
+ subprocess.call(['ip', 'rule', 'del', 'table', '7'])
+ subprocess.call(['ip', 'rule', 'del', 'table', '8'])
+
@expectedFailureIfRoutingPolicyPortRangeIsNotAvailable()
def test_routing_policy_rule_port_range(self):
self.copy_unit_to_networkd_unit_path('25-fibrule-port-range.network', '11-dummy.netdev')