From: Susant Sahani Date: Thu, 17 Aug 2023 13:50:02 +0000 (+0530) Subject: CI: network dhcp6 - Add test for custom client identifier X-Git-Tag: v255-rc1~694^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=543d2a4d45ba199a62c87b3bf69dfd4ff55abf0c;p=thirdparty%2Fsystemd.git CI: network dhcp6 - Add test for custom client identifier --- diff --git a/test/test-network/conf/25-dhcp-client-ipv6-only-custom-client-identifier.network b/test/test-network/conf/25-dhcp-client-ipv6-only-custom-client-identifier.network new file mode 100644 index 00000000000..edd5b7f5017 --- /dev/null +++ b/test/test-network/conf/25-dhcp-client-ipv6-only-custom-client-identifier.network @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Match] +Name=veth99 + +[Network] +DHCP=ipv6 +IPv6Token=::1a:2b:3c:4d + +[Route] +Gateway=_ipv6ra +Destination=2001:1234:5:9fff:ff:ff:ff:ff/128 + +[DHCPv6] +DUIDType=custom +DUIDRawData=00:00:ab:11:f9:2a:c2:77:29:f9:5c:00 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 07afe354f79..799d3bf784d 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -5018,6 +5018,41 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities): self.assertIn('DHCPREPLY(veth-peer)', output) self.assertNotIn('rapid-commit', output) + def test_dhcp_client_ipv6_only_with_custom_client_identifier(self): + copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client-ipv6-only-custom-client-identifier.network') + + start_networkd() + self.wait_online(['veth-peer:carrier']) + start_dnsmasq() + self.wait_online(['veth99:routable', 'veth-peer:routable']) + + # checking address + output = check_output('ip address show dev veth99 scope global') + print(output) + self.assertRegex(output, r'inet6 2600::[0-9a-f:]*/128 scope global dynamic noprefixroute') + self.assertNotIn('192.168.5', output) + + # checking semi-static route + output = check_output('ip -6 route list dev veth99 2001:1234:5:9fff:ff:ff:ff:ff') + print(output) + self.assertRegex(output, 'via fe80::1034:56ff:fe78:9abd') + + # Confirm that ipv6 token is not set in the kernel + output = check_output('ip token show dev veth99') + print(output) + self.assertRegex(output, 'token :: dev veth99') + + print('## dnsmasq log') + output = read_dnsmasq_log_file() + print(output) + self.assertIn('DHCPSOLICIT(veth-peer) 00:00:ab:11:f9:2a:c2:77:29:f9:5c:00', output) + self.assertNotIn('DHCPADVERTISE(veth-peer)', output) + self.assertNotIn('DHCPREQUEST(veth-peer)', output) + self.assertIn('DHCPREPLY(veth-peer)', output) + self.assertIn('sent size: 0 option: 14 rapid-commit', output) + + stop_dnsmasq() + def test_dhcp_client_ipv4_only(self): copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client-ipv4-only.network')