summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSusant Sahani <ssahani@gmail.com>2023-09-05 12:10:22 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-09-06 08:53:11 +0200
commit681007ac208cff3a1d2b7d359f1321eb1005b308 (patch)
tree8c83b5c7fc91b02b9290a5fea8de361b9d998d52 /test
parentMerge pull request #29088 from yuwata/libsystemd-network-headers (diff)
downloadsystemd-681007ac208cff3a1d2b7d359f1321eb1005b308.tar.xz
systemd-681007ac208cff3a1d2b7d359f1321eb1005b308.zip
test-network: Add test for PREF64
Diffstat (limited to 'test')
-rw-r--r--test/test-network/conf/25-ipv6ra-prefix-client.network1
-rw-r--r--test/test-network/conf/25-ipv6ra-prefix.network4
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py13
3 files changed, 18 insertions, 0 deletions
diff --git a/test/test-network/conf/25-ipv6ra-prefix-client.network b/test/test-network/conf/25-ipv6ra-prefix-client.network
index a98f61efc3..b66be594b2 100644
--- a/test/test-network/conf/25-ipv6ra-prefix-client.network
+++ b/test/test-network/conf/25-ipv6ra-prefix-client.network
@@ -12,3 +12,4 @@ PrefixAllowList=2001:db8:0:1:: 2001:db8:0:1:: 2001:db8:0:1::/64
PrefixDenyList=2001:db8:0:1::/64 2001:db8:0:1:: 2001:db8:0:3::/64
RouteDenyList=2001:db1:fff::/64 2001:db1:fff:: 2001:db2:fff::/64
UseDomains=yes
+UsePREF64=yes
diff --git a/test/test-network/conf/25-ipv6ra-prefix.network b/test/test-network/conf/25-ipv6ra-prefix.network
index 0afdda5a2e..bc6873298b 100644
--- a/test/test-network/conf/25-ipv6ra-prefix.network
+++ b/test/test-network/conf/25-ipv6ra-prefix.network
@@ -32,3 +32,7 @@ LifetimeSec=1000
[IPv6RoutePrefix]
Route=2001:db2:fff::/64
LifetimeSec=1000
+
+[IPv6PREF64Prefix]
+Prefix=64:ff9b::/96
+LifetimeSec=30m
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index c7c757a248..90d68b54db 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -14,6 +14,7 @@ import pathlib
import re
import shutil
import signal
+import socket
import subprocess
import sys
import time
@@ -6328,6 +6329,18 @@ class NetworkdIPv6PrefixTests(unittest.TestCase, Utilities):
output = check_output(*networkctl_cmd, '--json=short', 'status', env=env)
check_json(output)
+ output = check_output(*networkctl_cmd, '--json=short', 'status', 'veth-peer', env=env)
+ check_json(output)
+
+ # PREF64 or NAT64
+ pref64 = json.loads(output)['NDisc']['PREF64'][0]
+
+ prefix = socket.inet_ntop(socket.AF_INET6, bytearray(pref64['Prefix']))
+ self.assertEqual(prefix, '64:ff9b::')
+
+ prefix_length = pref64['PrefixLength']
+ self.assertEqual(prefix_length, 96)
+
def test_ipv6_route_prefix_deny_list(self):
copy_network_unit('25-veth.netdev', '25-ipv6ra-prefix-client-deny-list.network', '25-ipv6ra-prefix.network',
'12-dummy.netdev', '25-ipv6ra-uplink.network')